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
Return type void
is adopted by variables
#6720
Comments
I think it doesn’t make sense to combine void with another type in a union. You can use It’s also not allowed in native union types in PHP 8: https://3v4l.org/TnGBT |
related with #9388 |
Fixed: phpstan/phpstan-src#2778 |
The fix for this is breaking things. Maybe this should have gone into a minor, not a patch release ? |
Hello @jrfnl, That's why I recommend pinning to a specific PHPStan version and update it with automated PRs from Dependabot or Renovate to have it under control. If you have composer.lock commited then it's fine to have a range in composer.json like If you don't have composer.lock commited then you should pin to a specific version in composer.json like With this recommendation the build is not suddenly going to fail because of an unintended PHPStan update. In any case please reproduce the issue on phpstan.org/try and open a bug report in phpstan/phpstan repo. Thank you! P.S. I appreciate your work on PHPCS, it's one of my favourite projects! |
@ondrejmirtes Thanks and happy to hear you like what you see in PHPCS! I will try and open an issue when I find the time. Might be a while. If you want more info sooner, here's a PR to fix a failing build: WordPress/WordPress-Coding-Standards#2416 And yes, this is a PHPCS related project and for those, I cannot easily "pin" PHPStan version, I cannot even add it in the Currently running it locally via a PHAR and in CI via the |
Yeah I wouldn't recommend Phive as it's not one of the supported installation methods here: https://phpstan.org/user-guide/getting-started Best way is through Composer which allows you to also use PHPStan extensions. Second best option is to just download the PHAR from https://github.com/phpstan/phpstan/releases which should make it easy to pin it to a specific version through URL like And don't worry, I understand semver. The expectations users should have are described in these articles:
PHPStan shares the same challenges with similar projects like TypeScript, which also can't avoid breaking users' builds in patch/minor versions. |
Understood.
... which unfortunately isn't an option as I explained above.
And that's basically what we currently do, just without the pinning. I deliberately didn't pin the version in the original setup as it means manual update rounds to keep up to date as Dependabot doesn't handle this kind of thing. I'll have a look whether
Understood and thank you for your help (and for PHPStan) ! |
@ondrejmirtes Just ran into another one which seem related as well:
Note: the method never returns |
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
Return type
void
is adopted by variables although no such type exists.Code snippet that reproduces the problem
https://phpstan.org/r/3fd8ffd6-0e6d-489a-9616-87ba446a038f
Expected output
No error. In PHP
void
becomesnull
. See: https://3v4l.org/6eTAdThe text was updated successfully, but these errors were encountered: