Skip to content

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

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

ViniTou wants to merge 5 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:

CI status: MySQL/PostgreSQL integration (8.4) red on GetContentTreeChildrenTest / PostPostLoadSubtreeTest: REST snapshot expects <isBookmarked>true</isBookmarked>, actual false. Behaviour change from ibexa/core IBX-6773 (#476, "Fixed loading Bookmarks for non-accessible content items", merged to core 6.0 on 2026-09-17), which CI now resolves. Unrelated to this PR; admin-ui's fixture/snapshot needs a follow-up under its own ticket.

SYMFONY_DEPRECATIONS_HELPER (max[...] thresholds) is dead under PHPUnit 11: phpunit-bridge's bootstrap.php returns early and SymfonyExtension registers no DeprecationErrorHandler, so the old threshold was silently doing nothing. This PR replaces it with PHPUnit 11's native deprecation gate: failOnDeprecation="true" + displayDetailsOnTestsThatTriggerDeprecations="true" on the root <phpunit> element, plus a <source baseline="..."> block (ignoreIndirectDeprecations="false", ignoreSuppressionOfDeprecations="true", <include><directory>src</directory></include>, covering src/lib, src/bundle, src/contracts, src/internal-contracts per the psr-4 autoload) so any new deprecation fails the suite while existing ones are baselined. ignoreIndirectDeprecations is false (not true): PHPUnit classifies a Symfony deprecation triggered from our code as "indirect" (the immediate caller is deprecation-contracts/function.php), so true would silently drop deprecated-vendor-API usages from our own code — false catches those too, while the baseline still limits the gate to genuinely new deprecations.

Per config:

  • phpunit.xml (unit/bundle suites) — gated. Baseline regenerated on PHP 8.4 (CI's highest matrix version): phpunit.baseline.xml, 15 issues (704 tests, exit 0, "15 issues were ignored by baseline") — all 15 are external (vendor-originated ctype_digit() deprecations); 0 internal (Since ibexa/...) messages. The 8.4 regeneration produced byte-identical output to the prior 8.3 baseline (no PHP-8.4-only deprecations were triggered by this repo's suite). Verified passing under both PHP 8.4 and PHP 8.3, each printing "15 issues were ignored by baseline" (exit 0 on both). Probe verified: injecting trigger_deprecation() into RoleTransformer::transform() made the suite fail (exit 1); removed afterwards (git diff -- src empty), suite passes again (exit 0).
  • phpunit.integration.xml — gate not enabled: only the dead SYMFONY_DEPRECATIONS_HELPER env line was removed. The suite cannot currently boot to completion in this environment (Symfony test container build fails, and further along the JMS translation extractor requires a Node.js runtime with @typescript-eslint/typescript-estree that isn't available locally), so no baseline could be generated. Left ungated for now; enabling it is future work once it can run to completion (e.g. in CI).

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

Merge note: this branch is stacked on the still-open phpunit-11 PR (this PR targets phpunit-11, not main) — the phpunit-11 PR must merge first.

  • 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.

Two follow-up commits on top of the above:

  • Restored failOnWarning="true" / failOnNotice="true" on the root <phpunit> element of both phpunit.xml and phpunit.integration.xml. PHPUnit 9's convertErrorsToExceptions/convertNoticesToExceptions/convertWarningsToExceptions were removed by the wave PR without their PHPUnit 10+ replacements, so notices and warnings were silently no longer failing the suite. phpunit.integration.xml already had failOnWarning; only failOnNotice was missing there.
  • Dropped the unused symfony/phpunit-bridge dependency: require-dev in composer.json and the <bootstrap class="Symfony\Bridge\PhpUnit\SymfonyExtension"/> line from both configs (the DAMA\DoctrineTestBundle extension in phpunit.integration.xml is untouched). The repo has zero usage of ClockMock, DnsMock, ExpectDeprecationTrait, expectDeprecation(), or SYMFONY_DEPRECATIONS_HELPER — the extension only wired those, and its deprecation handler is already inert under PHPUnit 11. composer why symfony/phpunit-bridge confirms nothing else in the tree requires it.

For QA:

N/A

Documentation:

N/A

@ViniTou
ViniTou force-pushed the phpunit-11-deprecation-gate branch from fcddfc5 to 6511d75 Compare September 17, 2026 16:30
@ViniTou
ViniTou force-pushed the phpunit-11-deprecation-gate branch from 6511d75 to 3a702d3 Compare September 18, 2026 10:30
@sonarqubecloud

Copy link
Copy Markdown

Base automatically changed from phpunit-11 to 6.0 September 21, 2026 08:37
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.

2 participants