问题标签 [phpcodesniffer]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
77 浏览

php - phpcs在windows os上存储值在哪里

我能够成功执行命令

但我不知道 phpcs 在 Windows 7 操作系统上的磁盘上存储这些值的位置。

0 投票
1 回答
121 浏览

phpstorm - 探查器中只有 PHPCS 函数

我在 El Capitan 上使用 PHPStorn、XDEBUG 和 PHP 代码嗅探器。我正在尝试分析 WordPress 主题。当我运行探查器时,我在探查器输出中找不到我的任何函数。

我看到的都是 PHP_CodeSniffer 相关函数。我究竟做错了什么?这是我第一次尝试使用个人资料,我什至不确定我是否问对了问题。

谢谢您的帮助。

https://www.dropbox.com/s/cv69tt1et658oia/cachegrind.out.1036?dl=0

PHP 探查器输出

0 投票
1 回答
64 浏览

php - 在 Windows 上安装/运行 CodeSniffer... 需要 $ 吗?

我知道这个问题似乎有点傻,但我完全不知道如何运行 CodeSniffer。

我关注了这个页面和其他几篇博客或互联网文章,但没有一篇给出看起来很全面的解释。

至少我 100% 确定它pear已成功安装,现在它与php. 但是,我仍然无法运行它。这是一张表明它的图片。

在此处输入图像描述

正如梨的页面所说,我认为我需要拥有$,但它不被识别为批处理或任何其他程序。

我还假设当前目录应该与 相同php,但是将目录更改为该目录也没有解决此问题。

如果您能提供任何建议,我将不胜感激。

0 投票
1 回答
170 浏览

php - 不清楚的代码嗅探器错误

我已经使用 php 代码跟踪了 html 标记:

当我运行代码嗅探器时,出现以下错误:

我试图在 html 视图中找到有关 php 构造的任何标准或描述,但没有任何关于它的内容。

也许,有人知道html中的外观if和说明应该如何?foreach

谢谢。

0 投票
1 回答
1100 浏览

php - 为我的项目编辑 phpci.yml 文件

我已经安装了 PHPCI 并在 PHPCI 中添加了一个名为“myproject”的项目进行测试。要求我在项目的根目录中包含一个“phpci.yml”文件。这是这个“phpci.tml”文件的样子:

单击此处查看文件模式。我应该编辑该文件的哪个部分以将其作为 myproject 的描述包含在我的项目中,如下所示?

  1. 项目根目录:myproject
  2. 数据库名称:mydb
  3. 数据库用户:root
  4. 数据库通行证:秘密
  5. 主机:本地主机

有人可以在这方面帮助我吗?

0 投票
3 回答
1868 浏览

php - PhpStorm - How to detect PHP error "Non-static method should not be called statically"?

With PHP, static method can be used in both static method and non-static method, and non-static method can only used in non-static method. That's why calling a dynamic method statically generates the E_STRICT error.

For example:

The last line will generated this PHP error (it's logic): enter image description here

I am currently working on a large PHP application that calls, in some PHP files, non-static methods statically. It was not a problem with an very old version of PHP but we have decided to migrate to the latest PHP version.

Manually check all the project files to identify this bad syntax will be too long (+ 1000 files)!

The built-in code inspection features of PhpStorm doesn't detect this type of error within the analyzed source code. Why? Should I configure something? How?

Below, my PHP code inspection configuration in PhpStorm:

enter image description here

Thanks!

0 投票
1 回答
10557 浏览

php - How to use CodeSniffer in Netbeans 8.1

I have installed Netbeans 8.1 and Xampp for Windows with PHP 5.6.

Netbeans 8.1 has the CodeSniffer installed by default. Xampp too (pear). And Netbeans detects the "standars":

CodeSniffer in Netbeans 8.1

But now, I don't know how to run CodeSniffer in my php files. There is no button, neither a menu.

How can I run it? In other versions of Netbeans there was an "Eye button" to run it.

0 投票
1 回答
834 浏览

php - 在 PHP CodeSniffer 中出现错误

当我尝试在 PHPStorm(10.0.3) 中打开文件时收到以下消息。

有人知道这是什么吗?

0 投票
1 回答
1944 浏览

xampp - 包“pear.php.net/PHP_CodeSniffer”没有可用的版本

在 windows7 上,我已经用 PEAR 安装了 XAMPP。我尝试安装 PHP_CodeSniffer 但我收到错误 No release available for package “pear.php.net/PHP_CodeSniffer”。我尝试pear clear_cache, pear update-chanels但仍然是同样的错误

0 投票
4 回答
18007 浏览

php - 根据 PSR-2 on PhpStorm 在文件末尾添加一个空行

我使用PSR-2来设置我的代码样式。

当我大多数时候使用 Codesniffer 检查文件时,我会收到以下错误。

很明显如何解决这个问题。我需要知道的是 PhpStorm 是否有办法添加1 newline at end of file

我已经从中加载了预定义的样式,Settings -> Editor -> Code Style -> PHP -> Set From -> PSR-1/PSR-2并且还使用了相应Reformat Code地更改了 CS。

一切都是固定的,除了新行。我错过了什么吗?