-
-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error using generics with class-string and proxy #4803
Comments
I don't know how to fix this one. The root issue is this: https://phpstan.org/r/052a2f58-8316-4135-94d0-36a1c4525172 The problem is that this behaviour is correct. It's kind of undetermined what should happen when we have The inferring type is a union. From the From the There isn't anything that says that |
BTW this was a similar problem #3623 but easier to fix (phpstan/phpstan-src@a1b7b38). |
@franmomu After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-34: Method Client::getRealClass() should return class-string<T of object> but returns class-string<Proxy<T of object>|T of object>.
+No errors |
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
15: Function Bug4803\resolve() should return T of object but return statement is missing.
-30: Dumped type: Bug4803\Proxy<T of object (method Bug4803\Foo::doFoo(), argument)>|T of object (method Bug4803\Foo::doFoo(), argument)
+30: Dumped type: T of object (method Bug4803\Foo::doFoo(), argument)
30: Method Bug4803\Foo::doFoo() should return T of object but return statement is missing.
-37: Dumped type: Bug4803\Proxy<stdClass>|stdClass
+37: Dumped type: stdClass
44: Dumped type: stdClass
-51: Dumped type: Bug4803\Proxy<stdClass>|stdClass
+51: Dumped type: stdClass Full report
|
Fixed by: phpstan/phpstan-src@3be90f0 |
Nice! thank you |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
So the idea is that having a function that receives a class-string of an object or a class-string of a Proxy of that object and it returns the class-string of the object.
Ref: #4802
Code snippet that reproduces the problem
https://phpstan.org/r/94be9c1a-f99d-4403-afb4-8f038433aaf1
Expected output
No issues
The text was updated successfully, but these errors were encountered: