Releases: slevomat/coding-standard
Releases · slevomat/coding-standard
5.0.0
New sniffs
SpreadOperatorSpacingSniff
: Enforces configurable number of spaces after the...
operatorDisallowArrayTypeHintSyntaxSniff
: Disallows usage of array type hint syntax (eg.int[]
,bool[][]
) in phpDocs in favour of generic type hint syntax (eg.array<int>
,array<array<bool>>
)TrailingCommaInCallSniff
: Enforces trailing commas in multi-line callsDisallowMixedTypeHintSniff
: Disallows usage of "mixed" type hint in phpDocsSuperfluousTraitNamingSniff
: Reports use of superfluous suffixTrait
for traits
Improvements
- Added support for generic and intersection types in PHP docs
- Improved support for more namespaces in a file
UselessIfConditionWithReturnSniff
: New optionassumeAllConditionExpressionsAreAlreadyBoolean
EarlyExitSniff
: More uselesselseif
andelse
conditions are reportedNullTypeHintOnLastPositionSniff
: Added support for@property
and@method
annotationsFullyQualifiedClassNameInAnnotationSniff
: Added support for@property
and@method
annotationsLongTypeHintsSniff
: Added support for@property
and@method
annotationsLongTypeHintsSniff
: Inline doccomments are checked nowReferenceUsedNamesOnlySniff
: Added support for@method
annotations (thanks to @hranicka)UselessParenthesesSniff
: Some useless parentheses were not reported
Fixes
OptimizedFunctionsWithoutUnpackingSniff
: Fix for trailing commas in function callsUnusedVariableSniff
: Fixed false positiveUselessVariableSniff
: Fixed false positive
⚠️ BC breaks
EmptyLinesAroundTypeBracesSniff
: Renamed toEmptyLinesAroundClassBracesSniff
and moved to namespaceClasses
DisallowEqualOperatorsSniff
: Moved to namespaceOperators
UselessConditionWithReturnSniff
: Splitted toUselessIfConditionWithReturnSniff
andUselessTernaryOperatorSniff
- Removed support for
@var
annotation in format/** @var $variable type */
for most of the sniffs - Removed support for
@param
annotations without parameter name for most of the sniffs AlphabeticallySortedUsesSniff
:psr12Compatible
option is now enabled by defaultNullableTypeForNullDefaultValueSniff
: Removed deprecatedenabled
optionClassConstantVisibilitySniff
: Removed deprecatedenabled
optionTypeHintDeclarationSniff
: MarkenableObjectTypeHint
option as deprecatedTypeHintDeclarationSniff
: Removed deprecatedusefulAnnotations
optionTypeHintDeclarationSniff
: Removed deprecatedenableNullableTypeHints
optionTypeHintDeclarationSniff
: Removed deprecatedenableVoidTypeHint
option- Removed deprecated
DisallowLateStaticBindingForContantsSniff
(alias forDisallowLateStaticBindingForConstantsSniff
)
4.8.7
Fixes:
DeclareStrictTypesSniff
: Fixed correct number of whitespaces in autofix and errormessage (thanks to @wietsewarendorff)RequireMultiLineTernaryOperatorSniff
: Fixed close tag w/o prior semi (thanks to @donatj)UnusedPrivateElementsSniff
: Fixed false positiveSuperfluousExceptionNamingSniff
: Fixed false positiveControlStructureSpacingSniff
: Fixed internal errorsDocCommentSpacingSniff
: Fixed infinite loopDisallowYodaComparisonSniff
: Don't fix assigment in conditionRequireOnlyStandaloneIncrementAndDecrementOperatorsSniff
: Fixed false positiveUnusedVariableSniff
: Fixed false positiveUselessParenthesesSniff
: Fixed false positiveReferencedNameHelper
: Fixed reference names with whitespace
4.8.6
Fixes:
UnusedVariableSniff
: Fixed false positivesUnusedPrivateElementsSniff
: Fixed false positivesUselessParenthesesSniff
: Fixed false positivesTraitUseSpacingSniff
: Fixer should not remove useful codeNamespaceDeclarationSniff
: Fixed false positiveRequireOneNamespaceInFileSniff
: Fixed false positiveControlStructureSpacingSniff
: Fixed false positiveUnusedUsesSniff
: Fixed false positiveRequireMultiLineTernaryOperatorSniff
: Fixed false positiveOptimizedFunctionsWithoutUnpackingSniff
: Fixed infinite loop
4.8.5
Fixes:
UnusedVariableSniff
: Fixed false positiveDisallowImplicitArrayCreationSniff
: Fixed false positiveDisallowImplicitArrayCreationSniff
: Fixed missing reportingUselessParenthesesSniff
: Fixed false positivesUselessParenthesesSniff
: Fixed internal error
4.8.4
4.8.3
4.8.2
4.8.1
4.8.0
New sniffs:
RequireOnlyStandaloneIncrementAndDecrementOperatorsSniff
: Reports++
and--
operators not used standaloneUselessParameterDefaultValueSniff
: Looks for useless parameter default valueDisallowLateStaticBindingForContantsSniff
: Disallows late static binding for constantsUselessLateStaticBindingSniff
: Reports useless late static bindingControlStructureSpacingSniff
: Enforces configurable number of lines around control structuresUselessConditionWithReturnSniff
: Reports useless conditions where both branches returntrue
orfalse
RequireTernaryOperatorSniff
: Requires ternary operator when possibleRequireMultiLineTernaryOperatorSniff
: Ternary operator has to be reformatted to more lines when the line length exceeds the given limitDisallowImplicitArrayCreationSniff
: Disallows implicit array creationDuplicateAssignmentToVariableSniff
: Looks for duplicate assignments to a variableDisallowContinueWithoutIntegerOperandInSwitchSniff
: Disallows use ofcontinue
without integer operand inswitch
because it's emits warning in PHP 7.3 and higherOptimizedFunctionsWithoutUnpackingSniff
: Reports functions that should not be invoked with argument unpacking because of opcache optimizations (thanks to @Majkl578)
Improvements:
DocCommentSpacingSniff
: New optionslinesCountBetweenAnnotationsGroups
andannotationsGroups
UselessParenthesesSniff
: New optionignoreComplexTernaryConditions
UnusedVariableSniff
: New optionignoreUnusedValuesWhenOnlyKeysAreUsedInForeach
EarlyExitSniff
: New optionignoreStandaloneIfInScope
ShortListSniff
: Improved fixer
Fixes:
EarlyExitSniff
: Fixed false positiveUnusedVariableSniff
: Fixed false positivesUselessParenthesesSniff
: Fixed false positiveModernClassNameReferenceSniff
: Fixed fixerRequireShortTernaryOperatorSniff
: Infinite loop fix (thanks to @dg)ReferenceUsedNamesOnlySniff
: Possible fix of false positivesDisallowIncrementAndDecrementOperatorsSniff
: Fixed error codes for post operators in some situationsIdentificatorHelper
: A lot of fixes