Skip to content

Commit bec0a6f

Browse files
Add test
1 parent 0fb0665 commit bec0a6f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/PHPStan/Analyser/nsrt/bug-4890.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,20 @@ public function updateObjectShape($entity): void
5050
assert(property_exists($entity, 'foo'));
5151
assertType('class-string<object{foo: Bug4890\HelloWorld, bar: int, baz?: string}>', get_class($entity));
5252
}
53+
54+
/**
55+
* @phpstan-template T of Proxy
56+
*
57+
* @param T $entity
58+
*
59+
* @return T
60+
*/
61+
public function updateGeneric($entity): object
62+
{
63+
assertType('class-string<T of Bug4890\Proxy (method Bug4890\HelloWorld::updateGeneric(), argument)>', get_class($entity));
64+
assert(property_exists($entity, 'myProp'));
65+
assertType('class-string<T of Bug4890\Proxy (method Bug4890\HelloWorld::updateGeneric(), argument)&hasProperty(myProp)>', get_class($entity));
66+
67+
return $entity;
68+
}
5369
}

0 commit comments

Comments
 (0)