From fe5138f1a6969db89bf937bc954dd8c6f8a961b6 Mon Sep 17 00:00:00 2001 From: Brown Date: Mon, 24 Jun 2019 17:51:06 -0400 Subject: [PATCH] Move misplaced tests --- tests/Template/TemplateExtendsTest.php | 73 ++++++++++++++++++++++++++ tests/Template/TemplateTest.php | 73 -------------------------- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/tests/Template/TemplateExtendsTest.php b/tests/Template/TemplateExtendsTest.php index 9353a4778..c8d1e8e68 100644 --- a/tests/Template/TemplateExtendsTest.php +++ b/tests/Template/TemplateExtendsTest.php @@ -1961,6 +1961,79 @@ class TemplateExtendsTest extends TestCase foreach ($bat as $num) {}', ], + 'implictIteratorTemplating' => [ + ' + */ + class SomeIterator implements IteratorAggregate + { + function getIterator() + { + yield 1; + } + } + + /** @param \IteratorAggregate $i */ + function takesIteratorOfInts(\IteratorAggregate $i) : void { + foreach ($i as $j) { + echo $j; + } + } + + takesIteratorOfInts(new SomeIterator());', + ], + 'genericInterface' => [ + ' $t + * @return T + */ + function generic(string $t) { + return f($t)->get(); + } + + /** @template T as object */ + interface I { + /** @return T */ + public function get() {} + } + + /** + * @template T as object + * @template-implements I + */ + class C implements I { + /** + * @var T + */ + public $t; + + /** + * @param T $t + */ + public function __construct(object $t) { + $this->t = $t; + } + + /** + * @return T + */ + public function get() { + return $this->t; + } + } + + /** + * @template T as object + * @param class-string $t + * @return I + */ + function f(string $t) { + return new C(new $t); + }', + ], ]; } diff --git a/tests/Template/TemplateTest.php b/tests/Template/TemplateTest.php index a754ea84c..cf8e95918 100644 --- a/tests/Template/TemplateTest.php +++ b/tests/Template/TemplateTest.php @@ -763,28 +763,6 @@ class TemplateTest extends TestCase foreach ($c->getIterator() as $k => $v) { atan($v); strlen($k); }', ], - 'implictIteratorTemplating' => [ - ' - */ - class SomeIterator implements IteratorAggregate - { - function getIterator() - { - yield 1; - } - } - - /** @param \IteratorAggregate $i */ - function takesIteratorOfInts(\IteratorAggregate $i) : void { - foreach ($i as $j) { - echo $j; - } - } - - takesIteratorOfInts(new SomeIterator());', - ], 'allowTemplatedIntersectionToExtend' => [ 'format("c");', ], - 'genericInterface' => [ - ' $t - * @return T - */ - function generic(string $t) { - return f($t)->get(); - } - - /** @template T as object */ - interface I { - /** @return T */ - public function get() {} - } - - /** - * @template T as object - * @template-implements I - */ - class C implements I { - /** - * @var T - */ - public $t; - - /** - * @param T $t - */ - public function __construct(object $t) { - $this->t = $t; - } - - /** - * @return T - */ - public function get() { - return $this->t; - } - } - - /** - * @template T as object - * @param class-string $t - * @return I - */ - function f(string $t) { - return new C(new $t); - }', - ], 'templateIntersectionLeft' => [ '