Skip to content

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

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

ViniTou wants to merge 3 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 no longer registers a DeprecationErrorHandler, so trigger_deprecation() calls were silently ignored (this repo had it set to disabled=1, which was itself a no-op). This replaces it with PHPUnit 11's native gate: failOnDeprecation + a <source baseline="..."> scoped to src/lib, src/bundle and src/contracts, so CI fails only on NEW deprecations.

The single config (phpunit.xml) is gated, with an empty baseline (0 pre-existing issues, confirmed identical when regenerated under both PHP 8.3 and PHP 8.4), after removing the dead SYMFONY_DEPRECATIONS_HELPER env line. Verified with a trigger_deprecation() probe in src/lib/PurgeClient/LocalPurgeClient.php::__construct() (exercised by tests/lib/PurgeClient/LocalPurgeClientTest.php): the suite correctly failed, then passed again after removal (git diff -- src clean). composer check-cs and phpstan analyse are unchanged (clean).

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

Base branch: 6.0 (this repo's PHPUnit 11 migration PR is already merged).

  • ignoreIndirectDeprecations is deliberately false: PHPUnit classifies a Symfony deprecation caused by our code as "indirect" (callee deprecation-contracts/function.php, caller the vendor method), so true would silently drop every deprecated-vendor-API usage. Vendor-originated baseline entries are expected; new ones fail the build until the baseline is refreshed on purpose.
  • 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.
  • Restored failOnWarning="true" and failOnNotice="true" on phpunit.xml: PHPUnit 9's convertErrorsToExceptions/convertNoticesToExceptions/convertWarningsToExceptions were dropped in PHPUnit 10+ and their replacements default to false, so notices and warnings had silently stopped failing the run.
  • Dropped the unused symfony/phpunit-bridge dependency and its SymfonyExtension bootstrap line from phpunit.xml: the extension only wires ClockMock/DnsMock, and its deprecation handler is inert under PHPUnit >=10; the repo has no ClockMock/DnsMock/ExpectDeprecationTrait/expectDeprecation()/SYMFONY_DEPRECATIONS_HELPER usage, so it was dead weight. composer why symfony/phpunit-bridge confirms nothing else in the project requires it.

For QA:

N/A

Documentation:

N/A

@ViniTou
ViniTou force-pushed the phpunit-11-deprecation-gate branch from 159cbe3 to b1978fb Compare September 17, 2026 15:12
@sonarqubecloud

Copy link
Copy Markdown

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