IBX-12606: Replaced the Symfony deprecation thresholds with PHPUnit's native deprecation gate - #123
Merged
Merged
Conversation
… native deprecation gate
ViniTou
force-pushed
the
phpunit-11-deprecation-gate
branch
from
September 17, 2026 16:45
a7d5c4d to
829bef8
Compare
…HPUnit 9 convert*ToExceptions strictness
…te actually fires FrameworkBundle::boot() calls ErrorHandler::register(null, false) whenever Symfony\Component\Runtime\SymfonyRuntime does not exist, permanently installing Symfony's ErrorHandler the first time the integration kernel boots in tests/bootstrap.php - before PHPUnit\Runner\ErrorHandler::enable() ever runs. Because that call is per-test and backs out silently whenever a foreign handler is already registered, failOnDeprecation never actually triggered for any deprecation raised during test execution. Requiring symfony/runtime makes FrameworkBundle::boot() call get_error_handler() instead, leaving no handler installed after kernel boot, so PHPUnit can register its own. Verified with a temporary trigger_error() probe in TranslationTest::setUp(): swallowed (exit 0) before this change, caught and failing the build (exit 1, Deprecations: 1) after.
|
barw4
approved these changes
Sep 23, 2026
konradoboza
approved these changes
Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description:
SYMFONY_DEPRECATIONS_HELPER(max[...]thresholds) has no effect under PHPUnit >=10: phpunit-bridge's bootstrap returns early and noDeprecationErrorHandleris registered, sotrigger_deprecation()calls (which are@-silenced) were never actually being counted or gated. This PR replaces the dead env var with PHPUnit 11's nativefailOnDeprecation="true"plus<source baseline="...">, so CI fails only on deprecations that are new relative to a committed baseline.ignoreIndirectDeprecationsis set tofalse(not the PHPUnit default) because PHPUnit classifies a deprecation as "indirect" whenever the immediate stack frame aroundtrigger_deprecation()is vendordeprecation-contractscode rather than ours —truewould silently drop exactly the deprecations most worth catching (our code calling a deprecated vendor API).falsecatches everything, and the baseline still keeps the gate scoped to new issues only.Per config:
phpunit.xml.dist(unit suite,tests/lib+tests/bundle): gated. Baseline generated with--generate-baseline; 0 pre-existing deprecations (empty baseline file).phpunit.integration.xml.dist(tests/integration): gated. The oldSYMFONY_DEPRECATIONS_HELPERenv line implied ~4 self deprecations were expected, but this suite runs fully in-process (schema/fixture loading disabled intests/bootstrap.php, no external DB required) and currently produces 0 deprecations — the baseline is empty. No suite was left ungated.Both
<source>blocks include all three PSR-4 roots (src/lib,src/bundle,src/contracts) percomposer.jsonautoload.To refresh a baseline after intentionally introducing new deprecations: ensure
vendor/is a real (non-symlinked) install matching this branch, then re-runvendor/bin/phpunit -c <config> --generate-baseline <baseline-file>.Verified:
composer check-csandcomposer phpstanstay green; a temporarytrigger_deprecation()probe added tosrc/lib/FieldType/FieldTypeFormMapperDispatcher.phpand exercised via its existing unit test made the run fail as expected (non-baselined deprecation), and passed again once the probe was removed.This branch is based on
origin/6.0.failOnWarning="true"andfailOnNotice="true"on bothphpunit.xml.distandphpunit.integration.xml.dist(the latter already hadfailOnWarning, onlyfailOnNoticewas missing). PHPUnit 9'sconvertErrorsToExceptions/convertNoticesToExceptions/convertWarningsToExceptionswere dropped by the PHPUnit 11 migration and their PHPUnit 10+ replacements default tofalse, so notices and warnings had silently stopped failing the run.symfony/phpunit-bridgedependency and noExpectDeprecationTrait/expectDeprecation()usage were found in this repo (re-verified viacomposer.json,git grepforSymfony\Bridge\PhpUnit,ClockMock,DnsMock,ExpectDeprecationTrait,expectDeprecation(,SYMFONY_DEPRECATIONS_HELPER) — nothing to remove or convert.For QA:
N/A
Documentation:
N/A