-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#4384Closed
Copy link
Labels
Description
Bug report
When a method has a return type, which gets narrowed in the child class, any information from the parent seems to be lost.
I think that this could be solved by making a child return type an intersection between its return type and that of the parent?
Code snippet that reproduces the problem
https://phpstan.org/r/9d725389-4e11-4b53-aa3f-df765c811e21
Expected output
I'd expect the dumped types to be array<string> for the Fail class, and array<string>|(callable(): array<string>) for the Good class (which already works).
And there should be no error for Fail::check.
Did PHPStan help you today? Did it make you happy in any way?
No response