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

Check of ini_get should be keeped in mind #3382

Closed
alexander-schranz opened this issue Jun 2, 2020 · 5 comments
Closed

Check of ini_get should be keeped in mind #3382

alexander-schranz opened this issue Jun 2, 2020 · 5 comments
Labels
Milestone

Comments

@alexander-schranz
Copy link

Bug report

If you check for ini_get in inside an if statement like here in symfony and access it later the check before is not kept in mind and so phpstan will fail.

Code snippet that reproduces the problem

https://phpstan.org/r/57150eac-dde7-4f08-b05d-549720c8e5ea

Expected output

No Errors

@ondrejmirtes
Copy link
Member

A work around is to use a variable: https://phpstan.org/r/2ed528dc-396b-43f0-9859-1a515439cf52

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Jun 2, 2020
@alexander-schranz
Copy link
Author

@ondrejmirtes yeah I solved it that way. Still would be great if phpstan could handle this as I remember it in some places it also did keep values in mind.

@phpstan-bot
Copy link
Contributor

@alexander-schranz After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-3: Parameter #1 $path of function realpath expects string, string|false given.
+No errors

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@d4edc59

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants