We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A property of type ?T[] can have any value assigned to it regardless of type without causing a type checking error.
?T[]
https://phpstan.org/r/53a657a5-2847-4df6-84d1-7c209839dc6f
Type errors on lines 13 and 15.
Yes, I'm using it in a current project.
The text was updated successfully, but these errors were encountered:
@gnarlyquack After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
@@ @@ 12: Dumped type: array<int>|null +13: Property Blah::$value (array<int>|null) does not accept array<int, string>. 14: Dumped type: array<'hello'|int> +15: Property Blah::$value (array<int>|null) does not accept array<int, Blah>. 16: Dumped type: non-empty-array<'hello'|Blah|int>
Sorry, something went wrong.
Fixed: phpstan/phpstan-src@a2b318a
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.
No branches or pull requests
Bug report
A property of type
?T[]
can have any value assigned to it regardless of type without causing a type checking error.Code snippet that reproduces the problem
https://phpstan.org/r/53a657a5-2847-4df6-84d1-7c209839dc6f
Expected output
Type errors on lines 13 and 15.
Did PHPStan help you today? Did it make you happy in any way?
Yes, I'm using it in a current project.
The text was updated successfully, but these errors were encountered: