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
1 Answer
Reset to default 0This command fixes "Loose comparisons":
vendor/bin/phpcbf --standard=WordPress,Universal --sniffs=Universal.Operators.StrictComparisons admin.php
本文标签: coding standardsphpcsphpcbf and loose comparisons
版权声明:本文标题:coding standards - phpcs, phpcbf and loose comparisons 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305649a1932665.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论