Skip to content

Support for regular expressions with #[IgnoreDeprecations] attribute#6341

Merged
sebastianbergmann merged 1 commit intosebastianbergmann:mainfrom
nikophil:ignore-deprecations-by-regex
Sep 23, 2025
Merged

Support for regular expressions with #[IgnoreDeprecations] attribute#6341
sebastianbergmann merged 1 commit intosebastianbergmann:mainfrom
nikophil:ignore-deprecations-by-regex

Conversation

@nikophil
Copy link
Copy Markdown
Contributor

@nikophil nikophil commented Aug 28, 2025

This will allow to only ignore specific deprecations, instead of all of them

@nikophil nikophil force-pushed the ignore-deprecations-by-regex branch from 82e35f3 to 8a5c9a3 Compare August 28, 2025 19:46
Comment thread src/Metadata/IgnoreDeprecations.php Outdated
return true;
}

public function shouldIgnore(string $message): bool
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not comfortable with the fact that a value object, which is what a Metadata object is supposed to be, makes a decision like that.

This decision should be moved to ErrorHandler::deprecationIgnoredByTest(), for example.

Copy link
Copy Markdown
Contributor Author

@nikophil nikophil Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

I must mention that I did the same thing in IgnorePhpunitWarnings: https://github.com/sebastianbergmann/phpunit/blob/main/src/Metadata/IgnorePhpunitWarnings.php#L40

do you want that I change that too?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please. This should be a separate PR to the 12.3 branch. Thanks!

@nikophil nikophil force-pushed the ignore-deprecations-by-regex branch from 8a5c9a3 to 8ab4448 Compare August 29, 2025 15:15
@nikophil nikophil force-pushed the ignore-deprecations-by-regex branch from 8ab4448 to afea22c Compare August 29, 2025 15:31
@sebastianbergmann sebastianbergmann changed the title Add regex pattern to #[IgnoreDeprecations] Add support for regular expressions to #[IgnoreDeprecations] Sep 23, 2025
@sebastianbergmann sebastianbergmann merged commit 1e68628 into sebastianbergmann:main Sep 23, 2025
25 checks passed
@sebastianbergmann sebastianbergmann changed the title Add support for regular expressions to #[IgnoreDeprecations] Support for regular expressions with #[IgnoreDeprecations] attribute Sep 23, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants