Skip to content
Latchkey

Symfony PHPUnit deprecations fail the build (SYMFONY_DEPRECATIONS_HELPER) in CI

Symfony's PHPUnit bridge counts triggered deprecations and, by default, fails the suite when any occur. The SYMFONY_DEPRECATIONS_HELPER variable controls the threshold; CI failing on deprecations means the mode is stricter than the deprecations you emit.

What this error means

PHPUnit reports all tests passing but exits non-zero with "Remaining self deprecation notices (N)" or "Remaining direct deprecation notices (N)", failing the CI job.

Symfony
Remaining direct deprecation notices (3)

  1x: Since symfony/framework-bundle 6.4: Not setting the "framework.handle_all_throwables" ...
    3x in OrderControllerTest::testShow from App\Tests\Controller

Common causes

Deprecations exceed the configured threshold

The default/strict helper mode fails when deprecation counts are above the allowed number, surfacing debt that must be addressed or explicitly tolerated.

A dependency upgrade introduced new deprecations

A newer Symfony or bundle version deprecated an API your code still uses, raising the count in CI.

How to fix it

Fix the deprecated usage the bridge names

  1. Read the deprecation messages; each names the API and where it is triggered.
  2. Update your code or config to the non-deprecated form.
  3. Re-run so the count drops to what the threshold allows.

Set an explicit threshold while you migrate

Use SYMFONY_DEPRECATIONS_HELPER to allow a known number (or weak to report without failing) as a temporary measure, not a permanent one.

.github/workflows/ci.yml
env:
  SYMFONY_DEPRECATIONS_HELPER: "max[direct]=0&max[self]=0"

How to prevent it

  • Address deprecations as they appear rather than raising the threshold.
  • Pin the deprecation policy in phpunit.xml.dist or the job env explicitly.
  • Run the suite on dependency bumps so new deprecations surface immediately.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →