Closed Rasmus-Bertell closed 3 months ago
Closing as invalid.
Please don't open support questions as issues.
Standards can include sniffs from other standards, so this is perfectly normal behaviour.
To see which sniffs are included for your ruleset, run PHPCS with the -e
flag.
I don't see any PSR2 or Squiz sniffs in here
PSR1 (3 sniffs)
---------------
PSR1.Classes.ClassDeclaration
PSR1.Files.SideEffects
PSR1.Methods.CamelCapsMethodName
PSR12 (17 sniffs)
-----------------
PSR12.Classes.AnonClassDeclaration
PSR12.Classes.ClassInstantiation
PSR12.Classes.ClosingBrace
PSR12.Classes.OpeningBraceSpace
PSR12.ControlStructures.BooleanOperatorPlacement
PSR12.ControlStructures.ControlStructureSpacing
PSR12.Files.DeclareStatement
PSR12.Files.FileHeader
PSR12.Files.ImportStatement
PSR12.Files.OpenTag
PSR12.Functions.NullableTypeDeclaration
PSR12.Functions.ReturnTypeDeclaration
PSR12.Keywords.ShortFormTypeKeywords
PSR12.Namespaces.CompoundNamespaceDepth
PSR12.Operators.OperatorSpacing
PSR12.Properties.ConstantVisibility
PSR12.Traits.UseDeclaration
Sorry, I read the output wrong. I thought it listed the sniffs a standard includes, but it just grouped them.
The whole output was
❯ ./vendor/bin/phpcs -e
The custom standard contains 60 sniffs
Generic (15 sniffs)
-------------------
Generic.ControlStructures.InlineControlStructure
Generic.Files.ByteOrderMark
Generic.Files.LineEndings
Generic.Files.LineLength
Generic.Formatting.DisallowMultipleStatements
Generic.Functions.FunctionCallArgumentSpacing
Generic.NamingConventions.UpperCaseConstantName
Generic.PHP.DisallowAlternativePHPTags
Generic.PHP.DisallowShortOpenTag
Generic.PHP.LowerCaseConstant
Generic.PHP.LowerCaseKeyword
Generic.PHP.LowerCaseType
Generic.WhiteSpace.DisallowTabIndent
Generic.WhiteSpace.IncrementDecrementSpacing
Generic.WhiteSpace.ScopeIndent
PEAR (1 sniff)
--------------
PEAR.Functions.ValidDefaultValue
PSR1 (3 sniffs)
---------------
PSR1.Classes.ClassDeclaration
PSR1.Files.SideEffects
PSR1.Methods.CamelCapsMethodName
PSR2 (9 sniffs)
---------------
PSR2.Classes.ClassDeclaration
PSR2.Classes.PropertyDeclaration
PSR2.ControlStructures.ElseIfDeclaration
PSR2.ControlStructures.SwitchDeclaration
PSR2.Files.ClosingTag
PSR2.Files.EndFileNewline
PSR2.Methods.FunctionCallSignature
PSR2.Methods.FunctionClosingBrace
PSR2.Methods.MethodDeclaration
PSR12 (17 sniffs)
-----------------
PSR12.Classes.AnonClassDeclaration
PSR12.Classes.ClassInstantiation
PSR12.Classes.ClosingBrace
PSR12.Classes.OpeningBraceSpace
PSR12.ControlStructures.BooleanOperatorPlacement
PSR12.ControlStructures.ControlStructureSpacing
PSR12.Files.DeclareStatement
PSR12.Files.FileHeader
PSR12.Files.ImportStatement
PSR12.Files.OpenTag
PSR12.Functions.NullableTypeDeclaration
PSR12.Functions.ReturnTypeDeclaration
PSR12.Keywords.ShortFormTypeKeywords
PSR12.Namespaces.CompoundNamespaceDepth
PSR12.Operators.OperatorSpacing
PSR12.Properties.ConstantVisibility
PSR12.Traits.UseDeclaration
Squiz (15 sniffs)
-----------------
Squiz.Classes.ValidClassName
Squiz.ControlStructures.ControlSignature
Squiz.ControlStructures.ForEachLoopDeclaration
Squiz.ControlStructures.ForLoopDeclaration
Squiz.ControlStructures.LowercaseDeclaration
Squiz.Functions.FunctionDeclaration
Squiz.Functions.FunctionDeclarationArgumentSpacing
Squiz.Functions.LowercaseFunctionKeywords
Squiz.Functions.MultiLineFunctionDeclaration
Squiz.Scope.MethodScope
Squiz.WhiteSpace.CastSpacing
Squiz.WhiteSpace.ControlStructureSpacing
Squiz.WhiteSpace.ScopeClosingBrace
Squiz.WhiteSpace.ScopeKeywordSpacing
Squiz.WhiteSpace.SuperfluousWhitespace
Describe the bug
I'm trying to configure phpcs, but I keep getting errors from standards I haven't defined in my phpcs.xml file.
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php -s
Expected behavior
I expect standards not defined in config to not be used.
Versions (please complete the following information)
Additional context
This might also be a configuration error on my part, but I can't for the life of me find proper information from the wiki. I had to search a long time to even find information that the file should be named phpcs.xml.
Please confirm
master
branch of PHP_CodeSniffer.