0

phpcs found many warnings about "Loose comparisons" and means, that phpcbf can these fix automatically. But phpcbf does not fixed them:

  93 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "=="
...
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
vendor/bin/phpcbf  --standard=WordPress admin.php 

No fixable errors were found

Time: 97ms; Memory: 12MB

Should phpcbf fix or not? If yes, how?

Thank you very much.

2
  • if it doesn't do it automatically it's super easy to do manually, have you reported this to PHPCS/CBF? And are you using the latest and greatest v3.8 of PHPCS? Note that this isn't a PHPCS stack it's a WordPress stack
    – Tom J Nowell
    Commented Dec 14, 2023 at 11:45
  • I know, there are commands to fix it, but I have some inline JavaScript that should be ignored. I use phpcs 3.8.0 and php 8.1. I have not reported this to PHPCS/CBF yet. I wanted to ask first if it should work, not that I have configured / installed something wrong.
    – pehu
    Commented Dec 14, 2023 at 13:10

1 Answer 1

0

This command fixes "Loose comparisons":

vendor/bin/phpcbf --standard=WordPress,Universal --sniffs=Universal.Operators.StrictComparisons admin.php
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 30 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.