Skip to content

Commit

Permalink
When [notifying the polyfill repos](paragonie/random_compat#154) abou…
Browse files Browse the repository at this point in the history
…t the polyfill rulesets, I came across [this issue](paragonie/random_compat#151) and figured we could fix that.

---

When `PHPCompatibility(ParagonieRandomCompat)` is run over the code in the `random_compat` repo 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 `random_compat`.
  • Loading branch information
jrfnl committed Oct 8, 2018
1 parent 67d89dc commit 5b660ed
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions PHPCompatibilityParagonieRandomCompat/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,24 @@
<exclude name="PHPCompatibility.Classes.NewClasses.typeerrorFound"/>
</rule>

<!-- Prevent false positives being thrown when run over the code of random_compat itself. -->
<rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated">
<exclude-pattern>/random_compat/lib/byte_safe_strings\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.stream_set_chunk_sizeFound">
<exclude-pattern>/random_compat/lib/random_bytes_dev_urandom\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Constants.RemovedConstants.mcrypt_dev_urandomDeprecatedRemoved">
<exclude-pattern>/random_compat/lib/random_bytes_mcrypt\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Extensions.RemovedExtensions.mcryptDeprecatedRemoved">
<exclude-pattern>/random_compat/lib/random_bytes_mcrypt\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.RemovedFunctions.mcrypt_create_ivDeprecatedRemoved">
<exclude-pattern>/random_compat/lib/random_bytes_mcrypt\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound">
<exclude-pattern>/random_compat/lib/random_bytes_libsodium\.php$</exclude-pattern>
</rule>

</ruleset>

0 comments on commit 5b660ed

Please sign in to comment.