Bug report
As can be seen in below's code snippet, using ReflectionObject::newInstance() (inherited from ReflectionClass::newInstance()) with a template type leads to an error:
Function should return T of object but returns object
Code snippet that reproduces the problem
https://phpstan.org/r/387d0287-c0cb-4aca-86bf-13c4329df80b
Expected output
I wouldn't expect an error here, because the reflection was done on a specific object. Calling newInstance should return a new instance of this exact class (or fail).
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
As can be seen in below's code snippet, using
ReflectionObject::newInstance()(inherited fromReflectionClass::newInstance()) with a template type leads to an error:Code snippet that reproduces the problem
https://phpstan.org/r/387d0287-c0cb-4aca-86bf-13c4329df80b
Expected output
I wouldn't expect an error here, because the reflection was done on a specific object. Calling
newInstanceshould return a new instance of this exact class (or fail).Did PHPStan help you today? Did it make you happy in any way?
No response