Skip to content

Commit 95dc9a6

Browse files
committed
Ruleset: prevent false positives on Symfony polyfill code
When `PHPCompatibility(SymfonyPolyfillPHPxx)` is run over the code in the Symfony polyfill repos itself, it will detect some non-issues. The code in the files is all wrapped within proper `defined()`, `version_compare()` and/or `function_exists()` conditions and will never be executed on incompatible PHP versions. This simple change prevents these non-issues from being reported. This fix does rely on people having installed the package in a directory called `polyfill-php##`.
1 parent 83d18e6 commit 95dc9a6

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

PHPCompatibilitySymfonyPolyfillPHP55/ruleset.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@
1313
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_last_error_msgFound"/>
1414
</rule>
1515

16+
<!-- Prevent false positives being thrown when run over the code of polyfill-php55 itself. -->
17+
<rule ref="PHPCompatibility.Constants.NewConstants.json_error_utf8Found">
18+
<exclude-pattern>/polyfill-php55/Php55\.php$</exclude-pattern>
19+
</rule>
20+
1621
</ruleset>

PHPCompatibilitySymfonyPolyfillPHP72/ruleset.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@
1515
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.mb_scrubFound"/>
1616
</rule>
1717

18+
<!-- Prevent false positives being thrown when run over the code of polyfill-php55 itself. -->
19+
<rule ref="PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound">
20+
<exclude-pattern>/polyfill-php72/Php72\.php$</exclude-pattern>
21+
</rule>
22+
1823
</ruleset>

0 commit comments

Comments
 (0)