admin管理员组

文章数量:1122832

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.

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.

Share Improve this question asked Dec 14, 2023 at 11:25 pehupehu 114 bronze badges 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
Add a comment  | 

1 Answer 1

Reset to default 0

This command fixes "Loose comparisons":

vendor/bin/phpcbf --standard=WordPress,Universal --sniffs=Universal.Operators.StrictComparisons admin.php

本文标签: coding standardsphpcsphpcbf and loose comparisons