Skip to content

Commit c14709f

Browse files
committed
PHPCS: selectively ignore some flagged PHP function deprecations
The PHPCS native `Generic.PHP.DeprecatedFunctions` sniff will flag calls to deprecated functions. As of PHP 8.5, PHP has deprecated a number of functions related to previously done resource to object migrations. For the purposes of this package, we are testing the `assertClosedResource()` polyfill. These tests use a number of deprecated functions, but these tests will only ever be run on PHP versions where the return value from the involved extension was still a resource. In other words, the PHP 8.5 deprecations will never be hit and the PHPCS sniff flagging them can be ignored.
1 parent 4eadd8b commit c14709f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.phpcs.xml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@
175175
<exclude-pattern>/tests/*\.php$</exclude-pattern>
176176
</rule>
177177

178+
<!-- These tests are limited via `@requires` tags and will only run on PHP versions where
179+
the functionality was not yet deprecated. -->
180+
<rule ref="Generic.PHP.DeprecatedFunctions.Deprecated">
181+
<exclude-pattern>/tests/Polyfills/AssertClosedResource(Curl|Finfo|Gd|XmlParser)Test\.php$</exclude-pattern>
182+
</rule>
183+
178184
<!-- The use of `static` in the test cases is on purpose to test support. -->
179185
<rule ref="Universal.CodeAnalysis.StaticInFinalClass">
180186
<exclude-pattern>/tests/*</exclude-pattern>

0 commit comments

Comments
 (0)