Could anyone tell me how they normally run phpcs or phpcbf in Bedrock? Been trying to make it work in Bedrock. On Vagrant it isn’t installed by default and on my local box I had to add it myself.
Did see the phpcs.xml in Bedrock though. So I assume the standard is loaded from there when I run phpcs from site. Is that so?
How can you deal with issues like
phpcbf web/app/themes/ianua/lib/widget.php
Changing into directory /Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/lib
Processing widget.php [PHP => 3187 tokens in 386 lines]... DONE in 36ms (155 fixable violations)
=> Fixing file: 1/155 violations remaining [made 50 passes]... ERROR in 1.78 secs
No fixable errors were found
Time: 1.84 secs; Memory: 12Mb
Checking it with code sniffer I got loads of errors. Here in brief:
phpcs web/app/themes/ianua/lib/widget.php
FILE: ...ign/ianua.imagewize.com/site/web/app/themes/ianua/lib/widget.php
----------------------------------------------------------------------
FOUND 166 ERRORS AND 18 WARNINGS AFFECTING 94 LINES
----------------------------------------------------------------------
1 | WARNING | [ ] A file should declare new symbols (classes,
| | functions, constants, etc.) and cause no other side
| | effects, or it should execute logic with side effects,
| | but should not do both. The first symbol is defined on
| | line 13 and the first side effect is on line 19.
| | (PSR1.Files.SideEffects.FoundWithSymbols)
28 | ERROR | [ ] Each class must be in a namespace of at least one
| | level (a top-level vendor name)
| | (PSR1.Classes.ClassDeclaration.MissingNamespace)
28 | ERROR | [ ] Class name "Ianua_Widget_Categories" is not in camel
| | caps format
| | (Squiz.Classes.ValidClassName.NotCamelCaps)
62 | WARNING | [ ] Line exceeds 120 characters; contains 141
| | characters (Generic.Files.LineLength.TooLong)
177 | WARNING | [ ] Line exceeds 120 characters; contains 191
| | characters (Generic.Files.LineLength.TooLong)
179 | WARNING | [ ] Line exceeds 120 characters; contains 189
| | characters (Generic.Files.LineLength.TooLong)
182 | WARNING | [ ] Line exceeds 120 characters; contains 177
| | characters (Generic.Files.LineLength.TooLong)
185 | WARNING | [ ] Line exceeds 120 characters; contains 198
| | characters (Generic.Files.LineLength.TooLong)
191 | ERROR | [ ] Each class must be in a file by itself
And I do run it form /Users/jasper/webdesign/ianua.imagewize.com/site
When I add standard PSR2 I see
phpcs --standard=PSR2 web/app/themes/ianua/lib/widget.php
FILE: ...ign/ianua.imagewize.com/site/web/app/themes/ianua/lib/widget.php
----------------------------------------------------------------------
FOUND 166 ERRORS AND 18 WARNINGS AFFECTING 94 LINES
----------------------------------------------------------------------
1 | WARNING | [ ] A file should declare new symbols (classes,
| | functions, constants, etc.) and cause no other
| | side effects, or it should execute logic with
| | side effects, but should not do both. The first
| | symbol is defined on line 13 and the first side
| | effect is on line 19.
28 | ERROR | [ ] Each class must be in a namespace of at least
| | one level (a top-level vendor name)
28 | ERROR | [ ] Class name "Ianua_Widget_Categories" is not in
| | camel caps format