Skip to content

Let a trait-pathed ignore entry take precedence over the class-pathed ones - #6411

Open
mlocati wants to merge 1 commit into
phpstan:2.2.xfrom
mlocati-forks:trait-context-baseline-own-error
Open

Let a trait-pathed ignore entry take precedence over the class-pathed ones#6411
mlocati wants to merge 1 commit into
phpstan:2.2.xfrom
mlocati-forks:trait-context-baseline-own-error

Conversation

@mlocati

@mlocati mlocati commented Sep 10, 2026

Copy link
Copy Markdown

When a class using a trait reports its own error with the same message and identifier as an error deduplicated directly into the trait, --generate-baseline records the class occurrence under the class path (count: 1) and the deduplicated error under the trait path (count: 1)
On re-run the class-pathed entry also absorbed the trait context of that class, so it was reported as expected 1 time but occurred 2 times: the generated baseline failed by itself.

An entry scoped to the trait file hides the deduplicated error for every using class, so it is now tried first: the class-pathed entries account only for the errors reported in the class files themselves.

… ones

When a class using a trait reports its own error with the same message and
identifier as an error deduplicated directly into the trait,
--generate-baseline records the class occurrence under the class path
(count: 1) and the deduplicated error under the trait path (count: 1).
On re-run the class-pathed entry also absorbed the trait context of that
class, so it was reported as expected 1 time but occurred 2 times: the
generated baseline failed by itself.

An entry scoped to the trait file hides the deduplicated error for every
using class, so it is now tried first: the class-pathed entries account only
for the errors reported in the class files themselves.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant