-
Notifications
You must be signed in to change notification settings - Fork 431
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
error_log() is impure #2884
error_log() is impure #2884
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace ImpureErrorLog; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
$message = 'foo'; | ||
$logfile = 'bar/baz.txt'; | ||
if (!error_log($message, 3, $logfile)) { | ||
assertType('bool', error_log($message, 3, $logfile)); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please always put the code you're testing into an anonymous function. The root scope behaves a little bit differently (see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, forgot about that. thanks for the headsup. |
||
|
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.
Please don't put at the end, but somewhere random in the middle. This is to prevent conflicts when merging into 1.11.x