phpcodesniffer Questions

3

Solved

I have both xdebug and PHP_CodeSniffer (PHPCS) working great on my installation of PHPStorm, but the one really annoying part is that the debugger now seems to be treating Code Sniffer errors as br...
Quiroz asked 17/7, 2012 at 17:49

12

Im trying to use CodeSniffer in PhpStorm. In settings->PHP->CLI Interpreter I linked to the php.exe Im using https://windows.php.net/ but also tried it with Cygwin and XAMPP. PhpStorm shows me t...
Sukin asked 9/8, 2018 at 7:56

3

Solved

I want to configure multiple installed paths for phpcs. I can add one via: phpcs --config-set installed_paths the/dir/to/standard I tried adding multiple by using : yet it did not work and the m...
Napier asked 19/6, 2015 at 8:51

4

In my team we are using codesniffer to enforce a coding style for a Symfony application, and just realized that the files without extension are not getting checked, even if we explicitly use the fi...
Encephalomyelitis asked 21/11, 2017 at 14:9

3

I've added a PHPCS configuration to get some standards into a legacy project. I'm using a relaxed version of PSR-2 as an interim step. Now what I want to do, is slowly remove the exclusions, one b...
Colcannon asked 6/7, 2015 at 14:4

4

Solved

I have been using PHP_CodeSniffer with jenkins, my build.xml was configured for phpcs as below <target name="phpcs"> <exec executable="phpcs"> <arg line="--report=checkstyle --re...
Ricky asked 14/2, 2012 at 16:45

3

This issue has been addressed before and I have tried to solutions offered and think I am doing something wrong. I am attempting to configure PHP Codesniffer on a Mac using Mountaion Lion. I don't ...
Rashida asked 9/3, 2013 at 20:39

3

Solved

I understand how phpcs is configurated with xml, but can not find how I disable some sniffs. This ist my current conf (don‘t even know if this is correct): <?xml version="1.0" encoding="UTF-8"?...
Drava asked 20/6, 2018 at 9:35

2

Solved

I want to see only error in codesniffer. Because file have too many warning and i have only correct the errors. Can any know how to to do that?
Sharlenesharline asked 9/12, 2016 at 9:51

1

Solved

My attempt to exclude the check for the EOL char on my Windows machine always results in this error message: >vendor\bin\phpcs.bat --standard=PSR2 --exclude=Generic.Files.LineEndings.InvalidEOL...
Halinahalite asked 11/3, 2019 at 9:31

3

Solved

Is there a PHPCS coding standard that would check that proper annotations (@param, @return, @throws, etc.) are present in a docblock, including the proper spacing between them?
Feeley asked 7/12, 2012 at 16:58

1

How to setup PHP CodeSniffer for project with personal rules that extend WordPress coding standards + autofix errors in VSCode on save? I have installed CodeSniffer globally composer global req...
Lorraine asked 5/12, 2018 at 15:12

3

Solved

It is possible to ignore some parts of code from a php file when it's analyzed by PHP_CodeSniffer?
Ravenous asked 29/11, 2010 at 17:26

2

Solved

/** * @param Varien_Event_Observer $observer eventobserver * @return void */ phpCodesniffer generate the following error for the above line. 41 | ERROR | Tag cannot be grouped with paramete...
Agency asked 2/9, 2015 at 8:44

11

Solved

I'm trying to install PHP CodeSniffer on OS X Mountain Lion - and I appear to be getting a strange problem When running 'phpcs' I get the following error: PHP Warning: include_once(PHP/CodeSniffe...
Umpteen asked 10/1, 2013 at 11:46

2

Solved

I've spent now over 2h on trying to figure out how to require the { in the same line as the method declaration instead of the default requirement being the next line. How can I get this done? I've ...
Bord asked 15/9, 2015 at 12:18

1

Solved

Is there a way to install PHPCodeSniffer and WordPress Coding Standards for PHP_CodeSniffer per project via Composer? I've installed both as dev dependencies and set the installed path to WordPress...
Josefajosefina asked 28/1, 2018 at 11:22

4

Solved

I use PSR-2 for code styling my code. When I inspect a file using Codesniffer most of the times I get the following error. 332 | ERROR | [x] Expected 1 newline at end of file; 0 found It's obvi...
Bodega asked 15/3, 2016 at 18:42

1

Solved

I'm working on a proprietary legacy code base and some variables are camel-cased while others are snake-cased. I'd like to clean up and enforce only camel-cased variable names but I can't seem to f...
Fates asked 6/8, 2017 at 9:49

1

Solved

In my custom sniff I added <rule ref="Generic.WhiteSpace.ScopeIndent"> <properties> <property name="indent" value="2" /> <property name="tabIndent" value="false" /> &l...
Mandalay asked 15/7, 2017 at 15:41

1

I'm looking for a rule that prevents empty lines after the opening brace of a class. I found the rule Squiz.WhiteSpace.FunctionOpeningBraceSpace for functions, but I can't find any for classes. A...
Freewill asked 28/3, 2017 at 9:7

2

Solved

I am trying to figure out which code style to enforce with the phpcs code sniffer. Since the popularity of Symfony2, it seems to be a good practice to use its code standard. On the other hand, its...
Tonsillectomy asked 15/6, 2015 at 16:30

4

I am trying to build a pre-commit script in SVN, and I want to run PHP_CodeSniffer on the modified lines only (as opposed to the whole file). So far I have this script: #!/bin/sh REPOS="$1" TXN="...
Schizophrenia asked 1/1, 2013 at 21:9

3

After a refactoring, we had something like this in one of our classes: class FooBar { // $foo was $bla before private $foo; public function setBlubbOnArrayOnlyOnce($value) { // $this->bla...
Mcburney asked 13/8, 2015 at 10:24

1

Solved

When running phpcs, I am getting an error of Protected member variable "myMethod" must contain a leading underscore. How do I exclude/ignore this error on the ruleset.xml? <?xml version="1.0"?&...
Perlite asked 23/5, 2016 at 19:29

© 2022 - 2024 — McMap. All rights reserved.