-
Notifications
You must be signed in to change notification settings - Fork 548
Mark file resource functions as having side effects #698
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
Mark file resource functions as having side effects #698
Conversation
resources/functionMetadata.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this reminds me of, whether file_put_contents and file_get_contents is missing in this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only included the functions that work on file handles. But I guess all filesystem operations probably should be added. In that case it should also include unlink(), file(), mkdir(), and tons of others. I'll try to do that and see if anything breaks.
86d0fd8 to
5350992
Compare
|
Okay, here's a revised version, which adds most filesystem functions. Maybe in the future there should be more precise metadata than just "hasSideEffects". Some of these functions would be better described as "volatile". Or perhaps even an interface |
|
Hi, thank you! The file you modified is actually generated automatically when running I'd like this course of action instead:
Thank you! |
|
This got a bit complicated unfortunately. The phpstorm-stubs update has been merged. However, updating phpstorm-stubs to the newest master causes a few tests to fail. This is due to a change in phpstorm-stubs, which implements PHP RFC: Add return type declarations for internal methods. That RFC is about adding tentative return type declarations, which as I understand is about return type declarations that only trigger a warning, but aren't fully enforced yet (not until PHP 9.0). As an example, I'm not sure what the best course of action here. In the long term, PHPStan should probably parse |
5350992 to
1f30247
Compare
1f30247 to
8b5f94d
Compare
|
I see that tentative return types have been implemented and the stubs have been updated. I rebased this to fix conflicts. |
|
Thank you! |
Fixes phpstan/phpstan#5461