When running phpcs --standard=SlevomatCodingStandard --sniffs=SlevomatCodingStandard.ControlStructures.DisallowYodaComparison on this file, it results in an out-of-memory exception. Increasing the memory limit well beyond what should be necessary (ex. 1GB) does not help. However if an empty set of php tags is added like so:
It can now run without an out-of-memory error. However, now it reports a false positive on line 3. Attempting to fix this error automatically with phpcbf results in this code which is definitely not equivalent:
Consider the following small example php file:
When running
phpcs --standard=SlevomatCodingStandard --sniffs=SlevomatCodingStandard.ControlStructures.DisallowYodaComparison
on this file, it results in an out-of-memory exception. Increasing the memory limit well beyond what should be necessary (ex. 1GB) does not help. However if an empty set of php tags is added like so:It can now run without an out-of-memory error. However, now it reports a false positive on line 3. Attempting to fix this error automatically with
phpcbf
results in this code which is definitely not equivalent:Slevomat version: 8.15.0 PHP Version: 7.4.33