-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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 file existence before filemtime #20260
base: master
Are you sure you want to change the base?
Conversation
calling filemtime with a nonexistent file will cause a warning, even with the `@` error suppression. This avoids the warning by checking file existence before the modification time
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #20260 +/- ##
=========================================
Coverage 64.95% 64.95%
- Complexity 11396 11398 +2
=========================================
Files 430 430
Lines 36925 36925
=========================================
Hits 23984 23984
Misses 12941 12941 ☔ View full report in Codecov by Sentry. |
Why these tests report suppressed warnings? |
and again the same topic |
Is there a way to tell pest to respect |
Interesting. Thanks for the link @ailmanki, I hadn't thought of,
@samdark, yup Pest is a PHPUnit wrapper and PHPUnit reports the same warnings. There are currently no ways to ignore warnings in PHPUnit, but I could see about PR'ing a change. I'm not sure if the issue is actually lower though… should PHP even emit warnings when using error suppression? Edit: opened a discussion over in Pest's discussion forum to see if anyone over there has thoughts: pestphp/pest#1283 |
@markhuot Do you have any of these options enabled: https://docs.phpunit.de/en/10.5/error-handling.html#ignoring-issue-suppression ? |
@rob006, I've tried setting |
By default it should just work fine. Link by Rob clearly says:
So it should work. One thing am not sure and haven't checked is the PHPUnit version where this is applicable outside the latest. |
Calling filemtime with a nonexistent file will cause a warning, even with the
@
error suppression. This avoids the warning by checking file existence before the modification timeNote, this shows up for me when using https://pestphp.com because any test that emits a warning is marked as
!
instead of✓
. So for something like https://craftcms.com, which uses the->exists
during bootstrapping you end up with every test marked with!
.Before:
After: