Skip to content

Instantly share code, notes, and snippets.

@gsherwood
Last active December 24, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsherwood/6773172 to your computer and use it in GitHub Desktop.
Save gsherwood/6773172 to your computer and use it in GitHub Desktop.
PHP_CodeSniffer (phpcs-fixer branch) run over ZF2. Shows all existing errors (warnings are muted) and which ones can be fixed automatically using phpcbf (docs: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically)
$ php scripts/phpcs ../zf2/library/Zend/ --standard=PSR2 -p --report=source -ns
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
SOURCE COUNT
--------------------------------------------------------------------------------
[x] PSR2.Methods.FunctionCallSignature.Indent 328
[ ] PSR2.Methods.FunctionCallSignature.MultipleArguments 276
[x] PSR2.Methods.FunctionCallSignature.CloseBracketLine 248
[x] Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore 230
[x] PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket 220
[x] PSR2.Classes.ClassDeclaration.OpenBraceNotAlone 195
[x] Generic.WhiteSpace.ScopeIndent.Incorrect 157
[x] PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE 85
[ ] Squiz.ControlStructures.ControlSignature 62
[x] Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma 60
[x] PSR2.Classes.ClassDeclaration.SpaceBeforeComma 58
[x] PSR2.Classes.ClassDeclaration.ImplementsLine 58
[x] PSR2.Classes.ClassDeclaration.ExtendsLine 56
[ ] PSR2.ControlStructures.SwitchDeclaration.TerminatingComment 49
[ ] Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine 46
[x] PSR2.Classes.ClassDeclaration.CloseBraceAfterBody 41
[x] Generic.ControlStructures.InlineControlStructure.NotAllowed 36
[ ] Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterComma 30
[ ] Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase 25
[x] PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace 24
[ ] Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace 24
[ ] Squiz.Functions.MultiLineFunctionDeclaration.Indent 22
[ ] Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing 22
[x] Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma 20
[ ] Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine 19
[ ] Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction 17
[ ] Generic.Formatting.DisallowMultipleStatements.SameLine 15
[x] Generic.PHP.LowerCaseKeyword.Found 14
[x] Squiz.WhiteSpace.ScopeClosingBrace.Indent 11
[x] Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals 11
[x] PSR2.ControlStructures.SwitchDeclaration.BreakIndent 10
[x] Generic.PHP.LowerCaseConstant.Found 9
[x] PSR2.Classes.ClassDeclaration.SpaceBeforeName 7
[x] Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine 7
[ ] PSR1.Methods.CamelCapsMethodName.NotCamelCaps 7
[x] PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse 5
[x] PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT 4
[x] Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterDefault 4
[x] Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma 3
[x] Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose 3
[x] Squiz.Functions.MultiLineFunctionDeclaration.BraceIndent 2
[x] PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace 2
[x] Squiz.ControlStructures.ForEachLoopDeclaration.SpacingBeforeArrow 2
[x] Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower 2
[ ] PEAR.Functions.ValidDefaultValue.NotAtEnd 2
[ ] PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket 2
[x] Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg 1
[x] Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeComma 1
[x] PSR2.ControlStructures.SwitchDeclaration.SpacingAfterCase 1
[x] PSR2.Classes.ClassDeclaration.SpaceBeforeBrace 1
[x] Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceBeforeArrow 1
[x] Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceAfterArrow 1
[x] Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen 1
[x] Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose 1
[ ] Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBetween 1
[ ] Squiz.Classes.ValidClassName.NotCamelCaps 1
[ ] Squiz.Functions.MultiLineFunctionDeclaration.BraceOnNewLine 1
[ ] Squiz.Functions.MultiLineFunctionDeclaration.SpaceBeforeUse 1
[ ] PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket 1
[ ] Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterUse 1
[ ] PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket 1
--------------------------------------------------------------------------------
A TOTAL OF 2545 SNIFF VIOLATIONS WERE FOUND IN 61 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 39 MARKED SOURCES AUTOMATICALLY (1920 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------
Time: 1.05 minutes, Memory: 43.25Mb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment