wapmorgan / PhpDeprecationDetector

Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.
http://wapmorgan.github.io/PhpDeprecationDetector/
BSD 3-Clause "New" or "Revised" License
365 stars 37 forks source link

`@assert_on_string` false positive #87

Open Stadly opened 10 months ago

Stadly commented 10 months ago

If an assert starts with a string, such as assert('foo' === $bar), PhpDeprecationDetector outputs an error:

Function usage assert() (@assert_on_string) is changed.
You should avoid using string code: 'foo' in assert() usage

By changing to assert($bar === 'foo') no errors are output.

NathanGibbs3 commented 8 months ago

Here are the relevant PHP manual links for this. https://www.php.net/manual/en/function.assert Deprecation: https://www.php.net/manual/en/migration72.deprecated.php Removal: https://www.php.net/manual/en/migration80.incompatible.php