Releases: slevomat/coding-standard
Releases · slevomat/coding-standard
4.7.2
Fixes:
ReferenceUsedNamesOnlySniff
: Fixed false positivesRequireShortTernaryOperatorSniff
: Fixed false positiveStaticClosureSniff
: Fixed false positiveModernClassNameReferenceSniff
: Fixed fixerUnusedParameterSniff
: Fixed false positiveUnusedVariableSniff
: Fixed false positiveUselessInheritDocCommentSniff
: Fixed false positivesUselessParenthesesSniff
: Fixed false positive
4.7.1
Fixes:
UnusedParameterSniff
: Fixed false positiveUnusedVariableSniff
: Fixed false positivesUnusedInheritedVariablePassedToClosure
: Fixed false positivesRequireNullCoalesceOperatorSniff
: Fixed false positivesModernClassNameReferenceSniff
: Fixed false positives with get_class()ModernClassNameReferenceSniff
: Fixed error messagesUselessVariableSniff
: Fixed false positiveUselessParenthesesSniff
: Fixed false positivesUselessParenthesesSniff
: Fixed checks for parentheses around "case"
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
4.6.3
Fixes:
UnusedPrivateElementsSniff
: FixedalwaysUsedPropertiesAnnotations
support of prefixesUnusedPrivateElementsSniff
: Fixed false positive with constant in stringLongTypeHintsSniff
: Fixer should be case insensitiveTypeHintDeclarationSniff
: Added missing@inheritdoc
support for properties
4.6.2
4.6.1
Compatibility with PHPCS 3.3
Fixes:
ReferenceUsedNamesOnlySniff
: Fixed fixer for classes in doccommentsDisallowEqualOperatorsSniff
: Fixed message when operator is<>
(thanks to @carusogabriel)
4.6.0
New sniffs:
NamespaceDeclarationSniff
: Enforces one space afternamespace
, disallows content between namespace name and semicolon and disallows use of bracketed syntaxNamespaceSpacingSniff
: Enforces configurable number of lines before and afternamespace
RequireOneNamespaceInFileSniff
: Requires only one namespace in a fileDisallowIncrementAndDecrementOperatorsSniff
: Disallows using++
and--
operatorsRequireShortTernaryOperatorSniff
: Requires short ternary operator?:
when possibleDisallowShortTernaryOperatorSniff
: Disallows short ternary operator?:
DisallowEmptySniff
: Disallows use ofempty()
ShortListSniff
: Enforces using short form of list syntax,[...]
instead oflist(...)
(thanks to @Majkl578)
Improvements:
InlineDocCommentDeclarationSniff
: Reports empty@var
annotationsInlineDocCommentDeclarationSniff
: Reports invalid comment type used for inline documentation commentInlineDocCommentDeclarationSniff
: Reports doccomment above foreach and while as wellUseSpacingSniff
: Enforce zero number of lines between same types of use statementUnusedUsesSniff
:ignoredAnnotations
- Case sensitive list of annotation names that the sniff ignore completely (both name and content are ignored)TypeHintDeclarationSniff
:allAnnotationsAreUseful
- Doccomment is useful if it contain any annotation, optionusefulAnnotations
is deprecatedUnusedPrivateElementsSniff
:alwaysUsedPropertiesAnnotations
supports prefixesUnusedUsesSniff
: Improved@method
annotation parsing
Fixes:
EarlyExitSniff
: Fixed noticesEarlyExitSniff
: Fixed fixer for complicated logical conditionsUnusedUsesSniff
: Fixed false positivesUnusedPrivateElementsSniff
: Fixed false positive when property used innew
ReferencedNameHelper
:goto
label should not be resolved as constantTypeHelper
: Fixed regexp
4.5.2
4.5.1
4.5.0
New sniffs:
SuperfluousExceptionNamingSniff
: Reports usage of superfluous suffixException
for exceptionsSuperfluousAbstractClassNamingSniff
: Reports usage of superfluous prefix or suffixAbstract
for abstract classesSuperfluousInterfaceNamingSniff
: Reports usage of superfluous prefix or suffixInterface
for interfacesUseSpacingSniff
: Enforces configurable number of lines before firstuse
, after lastuse
and between two different types ofuse
(eg. betweenuse function
anduse const
)EmptyCommentSniff
: Reports empty commentsDocCommentSpacing
: Enforces configurable number of lines before first content (description or annotation), after last content (description or annotation), between description and annotations, between two different annotations typesDisallowOneLinePropertyDocCommentSniff
: Require comments with single-line content to be written as multi-liners (thanks to @Majkl578)RequireOneLinePropertyDocCommentSniff
: Require comments with single-line content to be written as one-liners (thanks to @Majkl578)TypeCastSniff
: Enforces using shorthand cast operators, forbids use of unset and binary cast operators (thanks to @Majkl578)
Improvements:
EarlyExitSniff
: New check "Remove useless elseif to reduce code nesting"UnusedUsesSniff
:ignoredAnnotationNames
- To ignore specified annotation names (thanks to @xificurk)ReferenceUsedNamesOnlySniff
: Improved annotations parsingFullyQualifiedClassNameInAnnotationSniff
: Improved annotations parsingForbiddenAnnotationsSniff
: Improved annotations parsingAlphaneticallySortedUsesSniff
: Make error message more clear (thanks to @brettdorrans)
Fixes:
EarlyExitSniff
: Reportelse
when all conditions contain early exit