Open 8ctopus opened 2 days ago
Yes, this is possible. Unfortunately, not everything that is possible is already documented (well enough), but the some documentation is available here.
For the most common use case, you want to have this in your phpunit.xml
configuration file:
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
<source><include><directory>src</directory></include></source>
tells PHPUnit that you consider only code in the src
directory as your own code (first-party code) (as well as your test code)vendor
, is considered "now your own code" (third-party code)ignoreIndirectDeprecations="true"
tells PHPUnit that you are only interested in E_DEPRECATED
and E_USER_DEPRECATED
that are triggered in your own code from your own coderestrictNotices="true
tells PHPUnit that you are only interested in E_NOTICE
and E_USER_NOTICE
triggered in your own coderestrictWarnings="true
tells PHPUnit that you are only interested in E_WARNING
and E_USER_WARNING
triggered in your own codeThank you!
I’m testing my packages for compatibility with PHP 8.4.1 and some dependencies trigger deprecation warnings.
Is there a way to configure
PHPUnit
to report deprecation warnings only for my package and ignore those from dependencies? In other words, ignore all deprecations within the vendor dir?