Skip to content
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

Support parsing of PhpStan's conditional return types #1963

Open
crozet-magenta opened this issue Nov 14, 2024 · 0 comments
Open

Support parsing of PhpStan's conditional return types #1963

crozet-magenta opened this issue Nov 14, 2024 · 0 comments

Comments

@crozet-magenta
Copy link

Since phpstan 1.6 it is possible to use conditional return statements, phpstorm supports parsing this type of phpdoc since 2022.3.1 but it seems that the inspection provided by this plugin does not and returns some false positives in the inspection results.

As seen in the screenshots, if the parameter $required is set to true the function will return a non nullable value so the null pointer exception will not happen later:
Screenshot 2024-11-14 at 11 49 49
Screenshot 2024-11-14 at 11 50 08

Not sure that this change is possible/easy to do but it would be great if someone can have a look at it and see if it is possible to handle this case. (Currently I add a phpdoc comment to silence this inspection but it does not seem to be ideal)
Screenshot 2024-11-14 at 11 51 29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant