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

Unable to deduce a complex logic #3190

Closed
Einenlum opened this issue Apr 20, 2020 · 6 comments
Closed

Unable to deduce a complex logic #3190

Einenlum opened this issue Apr 20, 2020 · 6 comments

Comments

@Einenlum
Copy link

Einenlum commented Apr 20, 2020

Bug report

(Sorry for the title, could not find one describing the issue. If you have one, you're very welcome to edit it)

Found an interesting bug. This is complex to solve, I think, but still, phpstan produces a warning when it should not. I know it's really far-fetched and this code should be refactored anyway, but I found this false positive report in an old legacy code.

$dedicated can only be true when $component is an instance of Server.

Code snippet that reproduces the problem

Expected output

Should raise no error.

@ondrejmirtes
Copy link
Member

Yes, there's a milestone with issues like these: https://github.com/phpstan/phpstan/milestone/12

You're better off rewriting the code so that PHPStan understands it, it's not hard: https://phpstan.org/r/7171be46-1c3b-44fd-8d34-6cb3d3ea46ba

@phpstan-bot
Copy link
Contributor

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

@@ @@
-15: Call to an undefined method object::getSize().
+No errors

@phpstan-bot
Copy link
Contributor

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

@@ @@
-15: Call to an undefined method object::getSize().
+No errors

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@56ae015

@Einenlum
Copy link
Author

Thank you very much 🙏

@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 May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants