Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jan 18, 2024
1 parent 2354321 commit 94efd67
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions tests/ArrayKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,51 +136,52 @@ class a {}
* @template TKey as array-key
* @template TValue as array-key
* @template T as array<TKey, TValue>
* @template TT
*
* @template TOrig as a|b
* @template TT as class-string<TOrig>
*
* @template TBool as bool
*/
class b {
/**
* @var array<TAlias, int>
*/
private array $a = [];
private array $a = [123 => 123];
/** @var array<value-of<T>, int> */
private array $c = [];
public array $c = [];
/** @var array<key-of<T>, int> */
private array $d = [];
public array $d = [];
/** @var array<TT, int> */
private array $e = [];
public array $e = [];
/** @var array<key-of<array<int, int>>, int> */
private array $f = [];
/** @var array<key-of<array<int, string>>, int> */
private array $f = [123 => 123];
/** @var array<value-of<array<int, int>>, int> */
private array $g = [];
/** @var array<value-of<array<int, string>>, int> */
private array $g = ["test" => 123];
/** @var array<TBool is true ? string : int, int> */
private array $h = [];
/**
* @param T $arr
* @param class-string<TT> $b
* @param TBool $c
*/
public function __construct(
array $arr,
string $b,
bool $c
) {}
private array $h = [123 => 123];
/**
* @return array<$v is true ? "a" : 123, 123>
*/
public function test(bool $v): array {
return $v ? ["a" => 123] : [123 => 123];
}
}',
}
/** @var b<"testKey", "testValue", array<"testKey", "testValue">, b, class-string<b>, true> */
$b = new b;
$b->d["testKey"] = 123;
// TODO
//$b->c["testValue"] = 123;
//$b->e["b"] = 123;
',
],
];
}
Expand Down

0 comments on commit 94efd67

Please sign in to comment.