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
A union with void should error because it leads to a fatal error #9185
Comments
Implemented: phpstan/phpstan-src#2763 |
great! but, @szepeviktor I wonder what this means for the wordpress void union types 🙈 |
@herndlm It's a fatal error in PHP so it shouldn't mean anything. |
they use such phpdoc types (so no fatal error) heavily, but the rule doesn't cover them I guess. there's #6720 for that I suppose :) |
Please see https://3v4l.org/jTGHE |
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
https://www.php.net/manual/en/language.types.void.php states
See https://3v4l.org/iRfF2
This was raised by @IanDelMar via szepeviktor/phpstan-wordpress#176
#6720 might be the same or is very related.
Note: Apparently WordPress uses union types of void with a scalar which annoyed me already, because I can't cast the return to a scalar without errors. E.g. https://developer.wordpress.org/reference%2Fclasses%2Fwpdb%2Fprepare%2F/
Code snippet that reproduces the problem
https://phpstan.org/r/23820230-f5a3-4533-9543-79b453cd5bd8
Expected output
There should be 2 errors IMO. The one about the invalid return type (union with void) is missing.
Did PHPStan help you today? Did it make you happy in any way?
The text was updated successfully, but these errors were encountered: