4.7.0
New sniffs:
ModernClassNameReferenceSniff
: Reports use of__CLASS__
,get_parent_class()
,get_called_class()
,get_class()
andget_class($this)
. Class names should be referenced via::class
contant when possibleStaticClosureSniff
: Reports closures not using$this
that are not declaredstatic
RequireCombinedAssignmentOperatorSniff
: Requires using combined assigment operators, eg+=
,.=
etcNullTypeHintOnLastPositionSniff
: Enforcesnull
type hint on last position in@var
,@param
and@return
annotationsUselessConstantTypeHint
: Reports useless@var
annotation (or whole documentation comment) for class constants because the type of constant is always clearUselessInheritDocCommentSniff
: Reports documentation comments containing only{@inheritDoc}
annotation because inheritance is automatic and it's not needed to use a special annotation for itTraitUseDeclarationSniff
: Prohibits multiple traits separated by commas in oneuse
statementTraitUseSpacingSniff
: Enforces configurable number of lines before firstuse
, after lastuse
and between twouse
statementsUnusedVariableSniff
: Looks for unused variablesUselessVariableSniff
: Looks for useless variablesUnusedParameterSniff
: Looks for unused parametersUnusedInheritedVariablePassedToClosureSniff
: Looks for unused inherited variables passed to closure viause
UselessAliasSniff
: Looks foruse
alias that is same as unqualified nameUselessSemicolonSniff
: Looks for useless semicolonsUselessParenthesesSniff
: Looks for useless parenthesesNewWithoutParenthesesSniff
: Reportsnew
with useless parentheses
Improvements:
RequireNullCoalesceOperatorSniff
:=== null
and!== null
conditions are detected tooRequireShortTernaryOperatorSniff
: Works with properties too
Fixes:
UnusedUsesSniff
: Fixed false positives for classes used in@see
annotationFullyQualifiedClassNameInAnnotationSniff
: Fixed fixerNamespaceSpacingSniff
: Fixed false positive whenphpcs
comment is before namespace