Skip to content

Conversation

nikophil
Copy link
Contributor

@nikophil nikophil commented Aug 2, 2025

I think it could be nice to be able to ignore deprecations using regex: see for instance doctrine/deprecations: they do insert the line number in their deprecation messages. Meaning that if they change some code in the file, if PHPUnit is not able to ignore deprecations based on regex, the code would break

@@ -112,7 +113,7 @@ public function equals(self $other): bool
return $this->file() === $other->file() &&
$this->line() === $other->line() &&
$this->hash() === $other->hash() &&
$this->description() === $other->description();
($this->description() === $other->description() || preg_match('{' . $this->description() . '}', $other->description) !== false);
Copy link
Contributor Author

@nikophil nikophil Aug 2, 2025

Choose a reason for hiding this comment

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

I'm actually wondering if we should use regex, or a simple str_contains(), WDYT? maybe both?

@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label Aug 3, 2025
@sebastianbergmann
Copy link
Owner

This pull request proposes a new feature and should therefore target the main branch.

@nikophil nikophil changed the base branch from 12.3 to main August 3, 2025 06:39
@nikophil nikophil force-pushed the feat/baseline-with-regex branch from 8b00bab to 3ef5f62 Compare August 3, 2025 06:40
@nikophil nikophil force-pushed the feat/baseline-with-regex branch from 3ef5f62 to 35d4338 Compare August 3, 2025 06:42
@nikophil
Copy link
Contributor Author

nikophil commented Aug 3, 2025

@sebastianbergmann done

@sebastianbergmann
Copy link
Owner

Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, I have decided not to merge it as I fail to see the benefit.

The baseline file is not supposed to be written or edited manually, it must only be generated using the --generate-baseline CLI option.

@nikophil
Copy link
Contributor Author

nikophil commented Aug 29, 2025

@sebastianbergmann damn you're right

I think I did mix up the two concepts which Symfony's PHPunit bridge offers:

  • the baseline, which is basically the same thing that PHPunit provides
  • the ignore file which allows to rely on regex to globally ignore deprecations

sorry for wasting your time 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants