PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD-3-CLAUSE License
Bot releases are hidden (Show)
Published by gsherwood over 2 years ago
PHP_CodeSniffer has run correctly under PHP 8.1 since PHP 8 support was added, but it has not supported new 8.1 language features until this release. Version 3.7.0 adds support for the following PHP 8.1 language features:
never
typeNote: Standards and sniffs included with PHP_CodeSniffer have been updated to support these language features, but external standards and sniffs may need updating before they are able to detect them correctly.
T_ENUM_CASE
token to represent the case statements inside an enumT_TYPE_INTERSECTION
token to represent the ampersand character inside intersection typesFile::getMethodParameters
now supports the new PHP 8.1 readonly token
property_readonly
array index is included in the return value
readonly_token
array index is included in the return value
Generic.PHP.LowerCaseKeyword
PSR2.Classes.PropertyDeclaration
Squiz.Commenting.BlockComment
Squiz.Commenting.DocCommentAlignment
Squiz.Commenting.VariableComment
Squiz.WhiteSpace.ScopeKeywordSpacing
Generic.PHP.UpperCaseConstant
and Generic.PHP.LowerCaseConstant
now ignore type declarations
true
/false
/null
when used as valuesGeneric.PHP.LowerCaseType
now supports the PHP 8.1 never
type
@throw
T_GOTO_LABEL
${
Published by gsherwood almost 3 years ago
Published by gsherwood about 3 years ago
Generic.Files.ExecutableFile
Generic.Files.LowercasedFilename
Generic.Files.LineEndings
Generic.Files.EndFileNewline
Generic.Files.EndFileNoNewline
Generic.PHP.ClosingPHPTag
Generic.PHP.Syntax
Generic.VersionControl.GitMergeConflict
Generic.WhiteSpace.DisallowSpaceIndent
Generic.WhiteSpace.DisallowTabIndent
T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG
and T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG
are unsuedT_BITWISE_AND
for all PHP versionsFile::getMethodParameters()
no longer incorrectly returns argument attributes in the type hint array index
has_attributes
array index is available and set to TRUE
if the argument has attributes definedGeneric.NamingConventions.ConstructorName
no longer throws deprecation notices on PHP 8.1
Squiz.Commenting.BlockComment
now correctly applies rules for block comments after a short echo tag
PEAR.Commenting.FunctionComment
Squiz.Commenting.InlineComment
Squiz.Commenting.BlockComment
Squiz.Commenting.VariableComment
Squiz.WhiteSpace.MemberVarSpacing
Published by gsherwood over 3 years ago
PHP_CodeSniffer has run under PHP 8 for some time, but it has not supported all new language features until this release. Version 3.6.0 adds support for all new PHP 8 language features, including:
Note: All standards and sniffs included with PHP_CodeSniffer have been updated to support these language features, but external standards and sniffs may need updating before they are able to detect them correctly.
T_TYPE_UNION
token is available to represent the pipe characterFile::getMethodParameters()
, getMethodProperties()
, and getMemberProperties()
will now return union typesT_PARAM_NAME
token is available to represent the label with the name of the function argument in itT_ATTRIBUTE
token marks the start of an attributeT_ATTRIBUTE_END
token is available to mark the end of an attributeattribute_owner
and attribute_closer
indexes are available in the tokens array for all tokens inside an attributePEAR.Commenting.ClassComment
PEAR.Commenting.FileComment
PSR1.Files.SideEffects
PSR12.Files.FileHeader
Squiz.Commenting.ClassComment
Squiz.Commenting.FileComment
Squiz.WhiteSpace.FunctionSpacing
T_MATCH
token to process match expressionsT_MATCH_ARROW
token is available to represent the arrows in match expressionsT_MATCH_DEFAULT
token is available to represent the default keyword in match expressionsGeneric.CodeAnalysis.AssignmentInCondition
Generic.CodeAnalysis.EmptyPHPStatement
Generic.CodeAnalysis.EmptyStatement
Generic.PHP.LowerCaseKeyword
PEAR.ControlStructures.ControlSignature
PSR12.ControlStructures.BooleanOperatorPlacement
Squiz.Commenting.LongConditionClosingComment
Squiz.Commenting.PostStatementComment
Squiz.ControlStructures.LowercaseDeclaration
Squiz.ControlStructures.ControlSignature
Squiz.Formatting.OperatorBracket
Squiz.PHP.DisallowMultipleAssignments
Squiz.Objects.ObjectInstantiation
Squiz.WhiteSpace.ControlStructureSpacing
T_FN_ARROW
token has changed from "T_FN_ARROW" to "PHPCS_T_FN_ARROW" to avoid package conflicts
T_FN_ARROW
constantFile::findStartOfStatement()
now works correctly when passed the last token in a statementFile::getMethodParameters()
now supports PHP 8.0 constructor property promotion
property_visibility
and visibility_token
index if property promotion is detectedFile::getMethodProperties()
now includes a return_type_end_token
index in the return value
--stdin-path
--stdin-path
to set the file pathGeneric.NamingConventions.AbstractClassNamePrefix
to enforce that class names are prefixed with "Abstract"
Generic.NamingConventions.InterfaceNameSuffix
to enforce that interface names are suffixed with "Interface"
Generic.NamingConventions.TraitNameSuffix
to enforce that trait names are suffixed with "Trait"
Generic.CodeAnalysis.UnusedFunctionParameter
can now be configured to ignore variable usage for specific type hints
ignoreTypeHints
array property to a list of type hints to ignoreGeneric.Formatting.MultipleStatementAlignment
can now align statements at the start of the assignment token
alignAtEnd
sniff property to false
to align the assignment tokenstrue
, so the assigned values are alignedGeneric.PHP.LowerCaseType
now supports checking of typed properties
Generic.PHP.LowerCaseType
now supports checking of union types
PEAR.Commenting.FunctionComment
and Squiz.Commenting.FunctionComment
sniffs can now ignore private and protected methods
minimumVisibility
sniff property to protected
to ignore private methodsminimumVisibility
sniff property to public
to ignore both private and protected methodsprivate
, so all methods are checkedPEAR.Commenting.FunctionComment
and Squiz.Commenting.FunctionComment
sniffs can now ignore return tags in any method
__construct
and __destruct
were ignoredspecialMethods
sniff property__construct
and __destruct
onlyPSR2.ControlStructures.SwitchDeclaration
now supports nested switch statements where every branch terminates
CASE
only contained a SWITCH
and no direct terminating statement, a fall-through error was displayedSWITCH
has a terminating statementPSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket
error message is now reported on the closing parenthesis token
Squiz.Commenting.FunctionComment
is now able to ignore function comments that are only inheritdoc statements
skipIfInheritdoc
sniff property to true
to skip checking function comments if the content is only {@inhertidoc}
false
, so these comments will continue to report errorsSquiz.Commenting.FunctionComment
now supports the PHP 8 mixed type
Squiz.PHP.NonExecutableCode
now has improved handling of syntax errors
Squiz.WhiteSpace.ScopeKeywordSpacing
now checks spacing when using PHP 8.0 constructor property promotion
is_readable()
Squiz.PHP.DisallowMultipleAssignments
sniff
Published by gsherwood almost 4 years ago
Published by gsherwood almost 4 years ago
T_NULLSAFE_OBJECT_OPERATOR
token has been made available for older versions
T_OBJECT_OPERATOR
have been modified to apply the same rules for the nullsafe object operatorPSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed
error message is now more accurate when using the allowOnly setting
PSR12.Functions.NullableTypeDeclaration
now supports the PHP8 static return type
Squiz.Formatting.OperatorBracket
false positive when exiting with a negative numberSquiz.PHP.DisallowComparisonAssignment
false positive for methods called on an objectPublished by gsherwood about 4 years ago
File::getMethodProperties()
now detects the PHP 8.0 static return type
Generic.NamingConventions.CamelCapsFunctionName
no longer reports __serialize
and __unserialize
as invalid names
PEAR.NamingConventions.ValidFunctionName
no longer reports __serialize
and __unserialize
as invalid names
Squiz.Scope.StaticThisUsage
now detects usage of $this
inside closures and arrow functions
Published by gsherwood over 4 years ago
T_FN
backfill now works more reliably so T_FN
tokens only ever represent real arrow functions
Generic.CodeAnalysis.EmptyPHPStatement
now detects empty statements at the start of control structuresPEAR.Functions.FunctionCallSignature
now always uses "parenthesis" instead of sometimes using "bracket"
Published by gsherwood over 4 years ago
File::getCondition()
now accepts a 3rd argument that allows for the closest matching token to be returned
Generic.PHP.DisallowRequestSuperglobal
to ban the use of the $_REQUEST
superglobal
Generic.ControlStructures.InlineControlStructure
no longer shows errors for while
and for
statements without a body
PSR12.ControlStructures.BooleanOperatorPlacement
can now be configured to enforce a specific operator position
allowOnly
property to first
to enforce all boolean operators to be at the start of a lineallowOnly
property to last
to enforce all boolean operators to be at the end of a linePSR12.Files.ImportStatement
now auto-fixes import statements by removing the leading slash
Squiz.ControlStructures.ForLoopDeclaration
now has a setting to ignore newline characters
FALSE
, so newlines are not allowed within for
definitionsignoreNewlines
setting in a ruleset.xml
file to changeSquiz.PHP.InnerFunctions
now handles multiple nested anon classes correctlyPublished by gsherwood almost 5 years ago
T_FN
token has been made available for older versions
T_FN
represents the fn
string used for arrow functionsT_FN_ARROW
token typefn
will have a T_FN token
for the function name, but have no scope information1_000
would tokenize as T_LNUMBER (1), T_STRING (_000)
T_LNUMBER (1_000)
File::getMethodParameters()
now supports arrow functionsFile::getMethodProperties()
now supports arrow functionsFixer::changeCodeBlockIndent()
to change the indent of a code block while auto-fixing
Generic.Files.ExecutableFile
sniff
Generic.CodeAnalysis.EmptyPhpStatement
now reports unnecessary semicolons after control structure closing braces
Generic.PHP.LowerCaseKeyword
now enforces that the fn
keyword is lowercase
Generic.WhiteSpace.ScopeIndent
now supports static arrow functionsPEAR.Functions.FunctionCallSignature
now adjusts the indent of function argument contents during auto-fixing
PSR2.Methods.FunctionCallSignature
PSR2.ControlStructures.ControlStructureSpacing
now checks whitespace before the closing parenthesis of multi-line control structures
PSR12.Functions.ReturnTypeDeclaration
now checks the return type of arrow functions
PSR12.Traits.UseDeclaration
now ensures all trait import statements are grouped together
Squiz.Functions.LowercaseFunctionKeywords
now enforces that the fn
keyword is lowercase
Published by gsherwood almost 5 years ago
Published by gsherwood about 5 years ago
--report=diff
and -vvv
command line argumentsPEAR.Functions.FunctionCallSignature.FirstArgumentPosition
PSR2.Methods.FunctionCallSignature.FirstArgumentPosition
PSR12.ControlStructures.BooleanOperatorPlacement
no longer complains when multiple expressions appear on the same line
PSR12.Files.FileHeader
no longer ignores comments preceding a use
, namespace
, or declare
statementPSR12.Files.FileHeader
now allows a hashbang line at the top of the filePublished by gsherwood about 5 years ago
PHP_CodeSniffer has included an in-progress PSR-12 standard since 3.3.0, but this release includes the completed standard. You can now check your code using the PSR-12 standard:
phpcs --standard=PSR12 /path/to/code
Most of the errors found can also be automatically fixed by PHPCBF:
phpcbf --standard=PSR12 /path/to/code
T_NULLABLE
inside property types, as it is elsewhereFile::getMemberProperties()
method, which now contains a type
array index
?
type_token
array indextype_end_token
array indexnullable_type
array index will also be set to TRUE
--filter=gitstaged
to check these filesphpcs.xsd
schema now validates phpcs-only
and phpcbf-only
attributes correctly
File
class now throw RuntimeException
instead of TokenizerException
RuntimeExpection
but now correctly throw TokenizerException
File::getMethodParameters()
method now returns more information, and supports closure USE groups
type_hint_end_token
array indexdefault_token
array indexdefault_equal_token
array indexcomma_token
array indexreference_token
array indexvariadic_token
array indexT_LIST
token and it's opening and closing parentheses now contain references to each other in the tokens array
T_ANON_CLASS
token and it's opening and closing parentheses now contain references to each other in the tokens array
T_BAD_CHARACTER
token has been made available for older versions
Squiz.WhiteSpace.FunctionSpacing
info
report to see blank lines before/after functionsSquiz.WhiteSpace.MemberVarSpacing
info
report to see blank lines before member varsGeneric.ControlStructures.DisallowYodaConditions
sniff
Generic.PHP.RequireStrictTypes
sniff
Generic.WhiteSpace.SpreadOperatorSpacingAfter
sniff
PSR12.Classes.AnonClassDeclaration
sniff
PSR12.Classes.ClosingBrace
sniff
PSR12.ControlStructures.BooleanOperatorPlacement
sniff
PSR12.ControlStructures.ControlStructureSpacing
sniff
PSR12.Files.DeclareStatement
sniff
PSR12.Files.FileHeader
sniff
PSR12.Files.ImportStatement
sniff
PSR12.Files.OpenTag
sniff
PSR12.Functions.ReturnTypeDeclaration
sniff
PSR12.Properties.ConstantVisibility
sniff
PSR12.Traits.UseDeclaration
sniff
Generic.Files.LineLength
ignoreComments
property now ignores comments at the end of a line
Generic.Files.LineLength
now only ignores unwrappable comments when the comment is on a line by itself
Generic.Functions.FunctionCallArgumentSpacing
no longer checks spacing around assignment operators inside function calls
Squiz.WhiteSpace.OperatorSpacing
sniff to enforce spacing around assignment operators
Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals
error has been removed
Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore
insteadGeneric.Functions.FunctionCallArgumentSpacing.NoSpaceAfterEquals
error has been removed
Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter
insteadGeneric.WhiteSpace.ScopeIndent
no longer performs exact indents checking for chained method calls
PEAR.WhiteSpace.ObjectOperatorIndent
now supports multi-level chained statements
multilevel
setting to TRUE
in a ruleset.xml
file to enable this behaviourPSR2.ControlStructures.ControlStructureSpacing
now allows whitespace after the opening parenthesis if followed by a comment
PSR2.Classes.PropertyDeclaration
now enforces a single space after a property type keyword
Squiz.Commenting.BlockComment
no longer requires blank line before comment if it's the first content after the PHP open tag
Squiz.Functions.FunctionDeclarationArgumentSpacing
now has more accurate error messages
SpaceAfterDefault
error code to SpaceAfterEquals
, which reflects the real errorSquiz.Functions.FunctionDeclarationArgumentSpacing
now checks for no space after a reference operator
SpacingAfterReference
error message in a ruleset.xml fileSquiz.Functions.FunctionDeclarationArgumentSpacing
now checks for no space after a variadic operator
SpacingAfterVariadic
error message in a ruleset.xml
fileSquiz.Functions.MultiLineFunctionDeclaration
now has improved fixing for the FirstParamSpacing
and UseFirstParamSpacing
errorsSquiz.Operators.IncrementDecrementUsage
now suggests pre-increment of variables instead of post-increment
Squiz.PHP.DisallowMultipleAssignments
now has a second error code for when assignments are found inside control structure conditions
Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
Squiz.PHP.DisallowMultipleAssignments.Found
Squiz.WhiteSpace.FunctionSpacing
now applies beforeFirst
and afterLast
spacing rules to nested functions
Squiz.WhiteSpace.OperatorSpacing
now has improved handling of parse errors
Squiz.WhiteSpace.OperatorSpacing
now checks spacing around the instanceof
operator
Squiz.WhiteSpace.OperatorSpacing
can now enforce a single space before assignment operators
ignoreSpacingBeforeAssignments
sniff property to FALSE
to enable checkingTRUE
, so spacing before assignments is not checked by defaultPublished by gsherwood over 5 years ago
Squiz.Arrays.ArrayDeclaration
now has improved handling of syntax errorsPublished by gsherwood over 5 years ago
The PEAR installable version of PHPCS was missing some files, which have been re-included in this release. The result of these omissions were:
code
report was not previously available for PEAR installsGeneric.Formatting.SpaceBeforeCast
sniff was not previously available for PEAR installsGeneric.WhiteSpace.LanguageConstructSpacing
sniff was not previously available for PEAR installsThanks to Juliette Reinders Folmer for the patch
T_PHPCS_SET
tokens now contain sniffCode
, sniffProperty
, and sniffPropertyValue
indexes
Generic.Commenting.DocComment
error messages now contain the name of the comment tag that caused the error
Generic.ControlStructures.InlineControlStructure
now handles syntax errors correctly
Generic.Debug.JSHint
now longer requires rhino and can be run directly from the npm install
Generic.Files.LineEndings
no longer adds superfluous new line at the end of JS and CSS files
Generic.Formatting.DisallowMultipleStatements
no longer tries fix lines containing phpcs:ignore
statements
Generic.Functions.FunctionCallArgumentSpacing
now has improved performance and anonymous class support
Generic.WhiteSpace.ScopeIndent
now respects changes to the exact
property using phpcs:set
mid-way through a file
exact
rule for only some parts of a fileGeneric.WhiteSpace.ScopeIndent
now disables exact indent checking inside all arrays
PEAR.Classes.ClassDeclaration
now has improved handling of PHPCS annotations and tab indentsPSR12.Classes.ClassInstantiation
has changed it's error code from MissingParenthesis
to MissingParentheses
PSR12.Keywords.ShortFormTypeKeywords
now ignores all spacing inside type casts during both checking and fixing
Squiz.Classes.LowercaseClassKeywords
now examines the class keyword for anonymous classes
Squiz.ControlStructures.ControlSignature
now has improved handling of parse errors
Squiz.Commenting.PostStatementComment
fixer no longer adds a blank line at the start of a JS file that begins with a comment
Squiz.WhiteSpace.SuperfluousWhitespace
sniffSquiz.Commenting.PostStatementComment
now ignores comments inside control structure conditions, such as FOR loops
Squiz.ControlStructures.ForLoopDeclaration
sniffSquiz.Commenting.FunctionCommentThrowTag
now has improved support for unknown exception types and namespaces
Squiz.ControlStructures.ForLoopDeclaration
has improved whitespace, closure, and empty expression support
SpacingAfterSecondNoThird
error code has been removed as part of these fixesSquiz.CSS.ClassDefinitionOpeningBraceSpace
now handles comments and indentation correctly
Squiz.CSS.ClassDefinitionClosingBrace
now handles comments, indentation, and multiple statements on the same line correctly
Squiz.CSS.Opacity
now handles comments correctly
Squiz.CSS.SemicolonSpacing
now handles comments and syntax errors correctly
Squiz.NamingConventions.ValidVariableName
now supports variables inside anonymous classes correctly
Squiz.PHP.LowercasePHPFunctions
now handles use statements, namespaces, and comments correctly
Squiz.WhiteSpace.FunctionSpacing
now fixes function spacing correctly when a function is the first content in a file
Squiz.WhiteSpace.SuperfluousWhitespace
no longer throws errors for spacing between functions and properties in anon classes
Zend.Files.ClosingTag
no longer adds a semi-colon during fixing of a file that only contains a comment
Zend.NamingConventions.ValidVariableName
now supports variables inside anonymous classes correctly
Published by gsherwood almost 6 years ago
The Generic.Formatting.NoSpaceAfterCast
sniff has been deprecated and will be removed in version 4.
The functionality of this sniff is now available in the Generic.Formatting.SpaceAfterCast
sniff. Include the Generic.Formatting.SpaceAfterCast
sniff and set the spacing
property to 0
to retain the existing functionality. As soon as possible, replace all instances of the old sniff code with the new sniff code and property setting in your ruleset.xml files. The existing sniff will continue to work until version 4 has been released.
T_BITWISE_NOT
added for the bitwise not operator
T_NONE
T_NONE
tokens with a tilde as the contents must now also look for T_BITWISE_NOT
T_NONE
as well as T_BITWISE_NOT
to support older PHP_CodeSniffer versionsT_BINARY_CAST
b
in b"some string with $var"
would be a T_BINARY_CAST
, but only when the string contained a varb
is always tokenized as T_BINARY_CAST
(binary)
from T_STRING_CAST
to T_BINARY_CAST
extend="true"
to the property tag
<property name="forbiddenFunctionNames" type="array" extend="true">
$XDG_CACHE_HOME
is set and points to a valid directory, it will be used for caching instead of the system temp directoryFile:: getMethodProperties()
method now includes a has_body
array index in the return value
File::getTokensAsString()
method now throws an exception if the $start
param is invalid
$length
param is invalid, an empty string will be returnedGeneric.CodeAnalysis.EmptyPHPStatement
sniff
Generic.Formatting.SpaceBeforeCast
sniff
Generic.VersionControl.GitMergeConflict
sniff
Generic.WhiteSpace.IncrementDecrementSpacing
sniff
PSR12.Functions.NullableTypeDeclaration
sniff
Generic.NamingConventions.CamelCapsFunctionName
PEAR.NamingConventions.ValidFunctionName
PSR1.Methods.CamelCapsMethodName
PSR2.Methods.MethodDeclaration
Squiz.Scope.MethodScope
Squiz.Scope.StaticThisUsage
Generic.CodeAnalysis.UnusedFunctionParameter
now only skips functions with empty bodies when the class implements an interface
Generic.CodeAnalysis.UnusedFunctionParameter
now has additional error codes to indicate where unused params were found
FoundInExtendedClass
: when the class extends anotherFoundInImplementedInterface
: when the class implements an interfaceFound
: used in all other cases, including closuresBeforeLastUsed
: the unused param was positioned before the last used param in the function signatureAfterLastUsed
: the unused param was positioned after the last used param in the function signatureFound
FoundBeforeLastUsed
FoundAfterLastUsed
FoundInExtendedClass
FoundInExtendedClassBeforeLastUsed
FoundInExtendedClassAfterLastUsed
FoundInImplementedInterface
FoundInImplementedInterfaceBeforeLastUsed
FoundInImplementedInterfaceAfterLastUsed
Generic.Classes.DuplicateClassName
now inspects traits for duplicate names as well as classes and interfaces
Generic.Files.InlineHTML
now ignores a BOM at the start of the file
Generic.PHP.CharacterBeforePHPOpeningTag
now ignores a BOM at the start of the file
Generic.Formatting.SpaceAfterCast
now has a setting to specify how many spaces are required after a type cast
spacing
setting in a ruleset.xml file to changeGeneric.Formatting.SpaceAfterCast
now has a setting to ignore newline characters after a type cast
ignoreNewlines
setting in a ruleset.xml file to changeGeneric.Formatting.SpaceAfterNot
now has a setting to specify how many spaces are required after a NOT operator
spacing
setting in a ruleset.xml file to changeGeneric.Formatting.SpaceAfterNot
now has a setting to ignore newline characters after the NOT operator
ignoreNewlines
setting in a ruleset.xml file to changePEAR.Functions.FunctionDeclaration
now checks spacing before the opening parenthesis of functions with no body
PEAR.Functions.FunctionDeclaration
now enforces no space before the semicolon in functions with no body
PSR2.Classes.PropertyDeclaration
now checks the order of property modifier keywords
PSR2.Methods.MethodDeclaration
now checks method declarations inside traits
Squiz.Commenting.InlineComment
now has better detection of comment block boundariesSquiz.Classes.ClassFileName
now checks that a trait name matches the filename
Squiz.Classes.SelfMemberReference
now supports scoped declarations and anonymous classes
Squiz.Classes.SelfMemberReference
now fixes multiple errors at once, increasing fixer performance
Squiz.Functions.LowercaseFunctionKeywords
now checks abstract and final prefixes, and auto-fixes errors
Squiz.Objects.ObjectMemberComma.Missing
has been renamed to Squiz.Objects.ObjectMemberComma.Found
Squiz.WhiteSpace.ObjectOperatorSpacing
is now more tolerant of parse errorsSquiz.WhiteSpace.ObjectOperatorSpacing
now fixes errors more efficiently
Published by gsherwood almost 6 years ago
Version 2.9.2 will be the final release of the PHP_CodeSniffer 2.9 branch, first released over 4 years ago. All developers still using version 2 are strongly encouraged to migrate to version 3.
Version 3 was first released as stable on the 4th of May 2017 and is a large refactoring of the code base that breaks backwards compatibility for all custom sniffs and custom reports. An upgrade guide for sniff and report developers is available here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Version-3.0-Upgrade-Guide
Note: If you only use the built-in coding standards (such as PEAR or PSR2), or you have a custom ruleset.xml file that only makes use of the sniffs and reports distributed with PHP_CodeSniffer, you do not need to make any changes to begin using PHP_CodeSniffer version 3.
Published by gsherwood about 6 years ago
--report=info
) now has improved formatting for metrics that span multiple lines
.bak
files when looking for test cases
Generic.PHP.NoSilencedErrors
error messages now contain a code snippet to show the context of the error
Squiz.Arrays.ArrayDeclaration
no longer reports errors for a comma on a line new after a here/nowdoc
SpaceBeforeComma
error message has been changed to only have one data value instead of twoSquiz.Commenting.FunctionComment
no longer errors when trying to fix indents of multi-line param commentsSquiz.Formatting.OperatorBracket
now correctly fixes statements that contain stringsSquiz.PHP.CommentedOutCode
now ignores more @-style annotations and includes better comment block detection