- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 20
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
x|void is not a valid type #250
Comments
This is too painful. |
Thanks, but that issue misses the point:
However, that's irrelevant to begin with I think because:
So if we have the option now, why keep using x|void in functionMap when we can do it correct now and not have to fix possibly tons of more types later on? |
What change do you propose? |
In functionMap.php change |
@johnbillion @IanDelMar @swissspidy Please vote! |
I think @kkmuffme made a very valid point. Additionally, there is/was a return type extension in phpstan-wordpress that did this as well. There is no reason to keep the |
Perhaps we need to be cautious with regard to hooks. Will PHPStan be able to recognise that an |
I started on this in the 6.7 release cycle, and will hopefully continue to make incremental progress on this and other PHPStan/typing issues in https://core.trac.wordpress.org/ticket/52217 (collab encouraged - I'm maintaining a list of tech-debt baselines in WordPress/wordpress-develop#7619 ). Probably not fast enough to obviate this ticket, but hopefully will lessen the impact either way 🤞 |
The lack of software principles cause this return type. |
e.g. https://github.com/php-stubs/wordpress-stubs/blame/v6.6.2/functionMap.php#L69
The correct type would be string|null
If you think it doesn't matter, try this:
The text was updated successfully, but these errors were encountered: