Description
Description
Dependencies
- Symfony 7.2
- PHPUnit 11.5
Scenario
Given a PHPUnit test that invokes code that in turn invokes trigger_deprecation
(in my case it was the Constraints/Url constructor from symfony/validator but that doesn't really matter).
Also assume to have stopOnDeprecation="true"
in your PHPUnit configuration.
Now if you run PHPUnit, it will exit once it hits the test that indirectly invokes trigger_deprecation
, and while doing so will not give any indication what happened. It will look like everything went fine (no warnings, exit code 0).
Only if you run PHPUnit with --debug
you will see something like this in the output:
Test Triggered Deprecation (namespace\of\Test::testMethod, issue triggered by third-party code, suppressed using operator)
Since symfony/validator 7.1: Not passing a value for the "requireTld" option to the Url constraint is deprecated. Its default value will change to "true".
trigger_error
invoked by trigger_deprecation
indeed uses the silence operator, so this explains the behavior.
Request
Document (on the symfony/deprecation-contracts GitHub page) how the package may affect PHPUnit test execution and what can be done to mitigate it (add <source ignoreSuppressionOfDeprecations="true">
to the PHPUnit configuration).
Maybe it's worth pursuing to change the behavior of PHPUnit there as well but I'm only concentrating on getting the current state documented here.
Example
No response