You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e16d776
Browse filesBrowse the repository at this point in the historyBrowse files
Account for deduplicated trait errors per using-class context
An error deduplicated directly into the trait stands for one occurrence
per using class. Until now it invisibly carried the file path of a single
using class - which one depended on the iteration order of collected data
(worker arrival order on a cold run, ksorted result-cache replay on a warm
run, append order on a partial run), so ignoreErrors matching and
--generate-baseline flickered between runs with no code changes.
The deduplicated Error now keeps all of its using-class contexts and is
attributed to the trait file itself:
- an ignoreErrors path pointing at the trait file hides the error for all
using classes (count: 1, as before);
- a path pointing at one using class accounts only for that class's
context - the remaining contexts stay reported, each "in context of"
its class, so a baseline generated by PHPStan <= 2.1 (one entry per
class) keeps working with no unmatched entries, while a single
class-pathed entry no longer hides the sibling contexts;
- --generate-baseline records the trait path for a fully surviving error
and the class path for a surviving context, deterministically.
Every consumer of the collected-data order is now order-independent, so
the winner-picking nondeterminism has no observable effect left.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GqdqYaCEx3xAS86gnCQhPq
Copy file name to clipboardExpand all lines: .github/workflows/e2e-tests.yml
+90-3Lines changed: 90 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -338,18 +338,105 @@ jobs:
338
338
../../bin/phpstan clear-result-cache
339
339
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan --error-format=raw")
340
340
../bashunit -a contains 'FooTrait.php:10:Strict comparison using === between int<0, max> and false will always evaluate to false.' "$OUTPUT"
341
-
# An ignoreErrors path may target the error by the trait file or by the using-class
342
-
# file - both keep working (no BC break).
341
+
# An ignoreErrors path may target the error by the trait file (hides it for
342
+
# all using classes) or by a using-class file - a class-pathed entry accounts
343
+
# only for its own class's context, so the other using class's context is
344
+
# still reported (see also the e2e/bug-14932 script).
343
345
../../bin/phpstan clear-result-cache
344
346
../bashunit -a exit_code "0" "../../bin/phpstan analyse --error-format=raw -c ignore-trait-path.neon"
345
347
../../bin/phpstan clear-result-cache
346
-
../bashunit -a exit_code "0" "../../bin/phpstan analyse --error-format=raw -c ignore-class-path.neon"
348
+
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse --error-format=raw -c ignore-class-path.neon")
349
+
../bashunit -a contains 'FooTrait.php (in context of class Bug14718\Bar):10:Strict comparison using === between int<0, max> and false will always evaluate to false.' "$OUTPUT"
350
+
../bashunit -a not_contains 'was not matched' "$OUTPUT"
347
351
# A generated baseline suppresses the error on re-run, with both an empty and a
348
352
# primed result cache (the issue reported baseline generation as impossible).
0 commit comments