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

False positive: Call to function file_get_contents() on a separate line has no effect. #5970

Closed
schlndh opened this issue Nov 10, 2021 · 3 comments

Comments

@schlndh
Copy link

schlndh commented Nov 10, 2021

Bug report

file_get_contents can be used to product a side-effect. It does not have to care about the returned content. However, even such usages should probably check for error. I'm also not sure if it's a good idea to use file_get_contents like this in the first place. So perhaps the message could simply be reworded.

Code snippet that reproduces the problem

https://phpstan.org/r/ef476598-c5e9-426e-8d0a-0156527e3bbe

Expected output

It should not be claimed that it doesn't have any effect.

@staabm
Copy link
Contributor

staabm commented Nov 10, 2021

Similar issues have been fixed recently in phpstan/phpstan-src#698

I guess you can just edit the same files and turn sideEffects on for file_get_contents

@ondrejmirtes
Copy link
Member

If it's your intended usage, just ignore the line.

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

No branches or pull requests

3 participants