Skip to content

IBX-12606: Replaced the Symfony deprecation thresholds with PHPUnit's native deprecation gate - #14

Open
ViniTou wants to merge 2 commits into
6.0from
phpunit-11-deprecation-gate
Open

ViniTou wants to merge 2 commits into
6.0from
phpunit-11-deprecation-gate

Conversation

@ViniTou

@ViniTou ViniTou commented Sep 17, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-12606

Description:

SYMFONY_DEPRECATIONS_HELPER thresholds are dead under PHPUnit ≥10 (phpunit-bridge's bootstrap returns early and registers no deprecation handler), so @-silenced trigger_deprecation() calls went unchecked. This repo had already migrated to PHPUnit 11 with no SYMFONY_DEPRECATIONS_HELPER env line left to remove, so this PR only adds the native gate: failOnDeprecation="true" + displayDetailsOnTestsThatTriggerDeprecations="true" on phpunit.xml.dist, plus a <source ignoreIndirectDeprecations="false" ignoreSuppressionOfDeprecations="true" baseline="phpunit.baseline.xml"> including rules/ (this repo's real production source dir per composer.json psr-4, not src/).

Only one config exists (phpunit.xml.dist, suite rules) and it gates cleanly: baseline is empty (0 issues, 0 internal / 0 external) — the 4-test suite currently triggers no deprecations. No suites were left ungated.

Caveat found while probing: PHPStan's own FileAnalyser::collectErrors() installs a private error handler around each file analysis (vendor/phpstan/phpstan/phpstan.phar, Analyser/FileAnalyser.php), and it does not forward suppressed/deprecated errors to any previously-registered handler. Since this repo's rule classes only run inside that analysis loop (via processNode(), invoked by PHPStan\Testing\RuleTestCase), a deprecation triggered from inside a rule's processNode() body is silently swallowed and will not fail the build — this is PHPStan's own testing-harness behavior, not something we patched or worked around (vendor code, out of scope). A deprecation triggered anywhere else that PHPUnit exercises directly (rule constructors, test/fixture code, library calls outside the analysis loop) is caught correctly, confirmed via probe (see PR conversation / task report for detail).

To refresh the baseline: ensure vendor/ is a real (non-symlinked) directory with PHPUnit 11 installed, then run vendor/bin/phpunit -c phpunit.xml.dist --generate-baseline phpunit.baseline.xml.

Merge note: this repo's PHPUnit 11 migration is already merged to 6.0, so this branch is built directly off origin/6.0 and is not stacked on any other open PR.

  • Baselines are generated on PHP 8.4 (CI's highest matrix version); PHP-native deprecations from vendor code (e.g. league/flysystem implicit-nullable parameters) only fire there. Regenerate with the highest PHP version in the matrix.

Additionally, in this pass:

  • Restored failOnNotice="true" on phpunit.xml.dist (alongside the already-present failOnWarning="true"), matching the PHPUnit 9 convertNoticesToExceptions/convertWarningsToExceptions strictness that PHPUnit 10 removed as flags — without it, notices and warnings would no longer fail the build.
  • No symfony/phpunit-bridge dependency exists in this repo (composer.json, no Symfony\Bridge\PhpUnit usage, no ClockMock/DnsMock/ExpectDeprecationTrait), so there is nothing to drop and no expectDeprecation() calls to convert.

For QA:

N/A

Documentation:

N/A

@ViniTou
ViniTou force-pushed the phpunit-11-deprecation-gate branch from 0e219ad to b064608 Compare September 17, 2026 16:34
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