我想配置多个已安装的路径phpcs.
我可以通过以下方式添加:
phpcs --config-set installed_paths the/dir/to/standard
我尝试使用添加多个:但它不起作用并且手册页不存在且帮助不那么有用.
我试图在我的 Windows 机器上排除对 EOL 字符的检查总是导致此错误消息:
>vendor\bin\phpcs.bat --standard=PSR2 --exclude=Generic.Files.LineEndings.InvalidEOLChar src\version.php
ERROR: The specified sniff code "Generic.Files.LineEndings.InvalidEOLChar" is invalid
Run "phpcs --help" for usage information
Run Code Online (Sandbox Code Playgroud)
无法弄清楚我做错了什么。我已经通过 composer 安装了 PHP CodeSniffer 并且正在运行 3.4.0 版。
我正在处理一些遗留代码,VScode 由于一些警告(例如Line exceeds 85 characters, contains 91 characters. 这非常烦人,我想将该限制提高到至少 120 个字符,甚至完全禁用它。我的垂直标尺已经设置为 120。
我如何移动或删除该限制?我一直在到处寻找,但找不到有效的答案......这是我的项目settings.json
{
"editor.wordWrapColumn": 120
}
Run Code Online (Sandbox Code Playgroud) 现在,我想对它们进行一些自定义,但似乎无法实现。
我收到 2 个警告,我想为我的所有项目删除这些警告:
MyTests::my_test_that_should_pass不是驼峰格式my_test_that_should_pass不是骆驼案例使用 PHPMD,我尝试更改 :.composer/vendor/phpmd/phpmd/src/main/resources/rulesets/controversial.xml并设置allow-underscore-test为这里true提到的
使用 PHPCS,我真的不知道该怎么做。
任何的想法???
我有以下代码:
/**
* @param TranscodingJob $transcodingJob
*
* @return TranscodingJob
* @throws \Lexik\Bundle\WorkflowBundle\Exception\WorkflowException
*/
public function onTranscodingJobError(TranscodingJob $transcodingJob) { ...
Run Code Online (Sandbox Code Playgroud)
...,我发现当我将鼠标悬停在注释上时,将出现以下注释:
phpcs:缺少参数注释
如何修改注释以使投诉消失?
(我尝试仅在参数的注释上方添加文本,但这似乎无法解决。)
我有一个项目同时使用 PHPMD(PHP 混乱检测器)和 PHPCS(PHP 代码嗅探器),这让我想知道是否所有 PHPMD 检查都可以替换为 PHPCS 检查,还是最好同时使用两者?
PHPMD 检查列表似乎在这里:https ://phpmd.org/rules/index.html但我没有找到任何关于 PHPMD 提供的好处的信息。
我目前正在运行php vendor/bin/phpcs --standard=PSR12 src我的几个项目的 CI。
他们已经失败了 6 个多月,因为我的代码组织如下:
\n\n<?php declare(strict_types=1);\n\n/**\n * This file is part of SimpleDTO, a PHP Experts, Inc., Project.\n *\n * Copyright \xc2\xa9 2019 PHP Experts, Inc.\n * Author: Theodore R. Smith <theodore@phpexperts.pro>\n * GPG Fingerprint: 4BF8 2613 1C34 87AC D28F 2AD8 EB24 A91D D612 5690\n * https://www.phpexperts.pro/\n * https://github.com/phpexpertsinc/SimpleDTO\n *\n * This file is licensed under the MIT License.\n */\n\nnamespace PHPExperts\\SimpleDTO;\nRun Code Online (Sandbox Code Playgroud)\n\n它当前生成几个 PHPCS 警告:
\n\n--------------------------------------------------------------------------------------------\nFOUND 3 ERRORS AFFECTING 2 LINES\n--------------------------------------------------------------------------------------------\n …Run Code Online (Sandbox Code Playgroud)