Skip to content

Commit

Permalink
Fix remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jan 26, 2022
1 parent 406c6c3 commit 00bbc35
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions tests/Template/ClassTemplateExtendsTest.php
Expand Up @@ -678,6 +678,9 @@ function getFooCollection() : Collection {
*/
class Collection1 extends ArrayIterator{}
/**
* @psalm-suppress MissingTemplateParam
*/
class Collection2 extends Collection1{}
class Collection3 extends Collection2{}
Expand Down Expand Up @@ -1371,6 +1374,8 @@ public function add($t) : void;
/**
* @template T
*
* @psalm-suppress MissingTemplateParam
*/
class C implements I {
/** @var array<T> */
Expand Down Expand Up @@ -1410,6 +1415,8 @@ public function add($t) : void;
/**
* @template T2
*
* @psalm-suppress MissingTemplateParam
*/
class C implements I {
/** @var array<T2> */
Expand Down Expand Up @@ -2058,9 +2065,17 @@ interface ICollection extends \IteratorAggregate {
public function getIterator();
}
/**
* @template TKey as array-key
* @template TValue
* @implements ICollection<TKey, TValue>
*/
class Collection implements ICollection {
/** @var array */
/** @var array<TKey, TValue> */
private $data;
/**
* @param array<TKey, TValue> $data
*/
public function __construct(array $data) {
$this->data = $data;
}
Expand All @@ -2069,7 +2084,6 @@ public function getIterator(): \Traversable {
}
}
/** @var ICollection<string, int> */
$c = new Collection(["a" => 1]);
foreach ($c->getIterator() as $k => $v) { atan($v); strlen($k); }',
Expand Down Expand Up @@ -2232,6 +2246,11 @@ public function getAnother() {
}
}
/**
* @template TT
*
* @extends Container<TT>
*/
class MyContainer extends Container {}
$a = (new MyContainer("hello"))->getAnother();',
Expand Down Expand Up @@ -2607,6 +2626,9 @@ public function get($t) {
}
}
/**
* @psalm-suppress MissingTemplateParam
*/
class AChild extends A {
/**
* @template T3
Expand Down Expand Up @@ -3706,6 +3728,9 @@ interface Templated {
public function foo();
}
/**
* @psalm-suppress MissingTemplateParam
*/
class Concrete implements Templated {
private array $t;
Expand Down

0 comments on commit 00bbc35

Please sign in to comment.