Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Dec 18, 2022
1 parent bccda92 commit 70d1a5a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/Template/ClassTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,49 @@ class ClassTemplateTest extends TestCase
public function providerValidCodeParse(): iterable
{
return [
'templateIntersection' => [
'code' => '<?php
interface EntityInterface
{
public function getId(): string;
}
/**
* @phpstan-template T of EntityInterface
*/
interface RepositoryInterface
{
/**
* @return T|null
*/
public function byId(string $id);
}
final class Foo implements EntityInterface
{
public function getId(): string
{
return "42";
}
}
/**
* @phpstan-implements RepositoryInterface<Foo>
*/
final class FooRepository implements RepositoryInterface
{
/**
* @var Foo[]
*/
public array $elements = [];
public function byId(string $id): ?Foo
{
return $this->elements[$id] ?? null;
}
}
'
],
'cachingIterator' => [
'code' => '<?php
Expand Down

0 comments on commit 70d1a5a

Please sign in to comment.