Releases: slevomat/coding-standard
Releases · slevomat/coding-standard
7.0.1
7.0.0
🆕 New sniffs
RequireNonCapturingCatchSniff: Requires non-capturingcatchwhen the variable with exception is not usedRequireNullSafeObjectOperatorSniff: Requires using?->operatorDisallowNullSafeObjectOperatorSniff: Disallows using?->operatorRequireTrailingCommaInDeclarationSniff: Enforces trailing commas in multi-line declarationsDisallowTrailingCommaInDeclarationSniff: Disallows trailing commas in multi-line declarationsRequireConstructorPropertyPromotionSniff: Requires use of constructor property promotionDisallowConstructorPropertyPromotionSniff: Disallows usage of constructor property promotionUnionTypeHintFormatSniff: Checks format of union type hintsDisallowNamedArgumentsSniff: Disallows usage of named argumentsDisallowTrailingCommaInCallSniff: Disallows trailing commas in multi-line callsForbiddenPublicPropertySniff: Disallows using public properties (thanks to @50bhan)FunctionLengthSniff: Disallows long function (thanks to @50bhan)
🔧 Improvements
- Support for union type hints
- Support for
mixedandstatictype hint - Support for
@phpstan-type,@psalm-type,@phpstan-import-typeand@psalm-import-typeannotations ReturnTypeHintSniff: New optionenableUnionTypeHintto enable support for union type hintsPropertyTypeHintSniff: New optionenableUnionTypeHintto enable support for union type hintsParameterTypeHintSniff: New optionenableUnionTypeHintto enable support for union type hintsReturnTypeHintSniff: New optionenableMixedTypeHintto enable support formixedtype hintPropertyTypeHintSniff: New optionenableMixedTypeHintto enable support formixedtype hintParameterTypeHintSniff: New optionenableMixedTypeHintto enable support formixedtype hintReturnTypeHintSniff: New optionenableStaticTypeHintto enable support forstatictype hintReturnTypeHintSniff: Reports useless@phpcsSuppressParameterTypeHintSniff: Reports useless@phpcsSuppressPropertyTypeHintSniff: Reports useless@phpcsSuppressUnusedParameterSniff: Reports useless@phpcsSuppressModernClassNameReferenceSniff: New optionenableOnObjectsto enable::classon all objectsNullableTypeForNullDefaultValueSniff: Support formixedand union type hintsReferenceUsedNamesOnlySniff: Improved fixerBlockControlStructureSpacingSniff: Ignoreifwith alternative syntaxRequireTernaryOperatorSniff: Improved fixerRequireMultiLineTernaryOperatorSniff: Support for more ternary operatorsRequireMultiLineTernaryOperatorSniff: New optionexpressionsMinLengthBlockControlStructureSpacingSniff: Improved behaviour forcaseanddefaultcontrol structuresJumpStatementsSpacingSniff:: No errors forthrowexpressions
🐛 Fixes
NegationOperatorSpacingSniff: Fixed false positiveBlockControlStructureSpacingSniff: Fixed false positiveUselessParenthesesSniff: Fixed false positivesJumpStatementsSpacingSniff: Fixed false positiveRequireCombinedAssignmentOperatorSniff: Possible string offset should only report error - fixer is disabled to prevent fatal errorsNegationOperatorSpacing: Fix for magic constants (thanks to @carusogabriel)RequireMultiLineTernaryOperatorSniff: Fixed false positivesRequireShortTernaryOperatorSniff: Fixed false positiveReferenceUsedNamesOnlySniff: Fixed problem with incorrect caseStrictCallSniff: Fixed false positiveEarlyExitSniff: Fixed false positivesDeclareStrictTypesSniff: Fixer should not remove comment beforeAlphabeticallySortedUsesSniff: Fixer should not remove comment beforeuseClassStructureSniff: Fixed internal error
⚠️ BC breaks
PropertyTypeHintSpacingSniff: RemovedCODE_NO_SPACE_BEFORE_TYPE_HINTbecause it's not possible on PHP 8DeclareStrictTypesSniff: Options renamed and modifed, see READMETrailingCommaInCallSniffrenamed toRequireTrailingCommaInCallSniff- Removed deprecated
UnusedPrivateElementsSniff - Removed
FullyQualifiedClassNameAfterKeywordSniff ReferenceUsedNamesOnlySniff: Removed optionfullyQualifiedKeywordsBlockControlStructureSpacingSniff: Options renamed and modified, see READMEJumpStatementsSpacingSniff: Options renamed and modified, see READMEParentCallSpacingSniff: Shorter options names, see README- All helpers are marked as internal
UselessFunctionDocCommentSniff: Removed suppress support
6.4.1
🐛 Fixes
NegationOperatorSpacingSniff: Fixed false positiveBlockControlStructureSpacingSniff: Fixed false positiveBlockControlStructureSpacingSniff: Ignoreifwith alternative syntaxJumpStatementsSpacingSniff: Fixed false positiveUselessParenthesesSniff: Fixed false positiveReferenceUsedNamesOnlySniff: Improved fixerRequireTernaryOperatorSniff: Improved fixer
6.4.0
📣 You can now sponsor Slevomat Coding Standard development
🆕 New sniffs
RequireSingleLineConditionSniff: Enforces conditions ofif,elseif,whileanddo-whileto be on a single lineRequireMultiLineConditionSniff: Enforces conditions ofif,elseif,whileanddo-whilewith one or more boolean operators to be splitted to more lines so each condition part is on its own lineRequireSingleLineCallSniff: Enforces function call to be on a single lineRequireMultiLineCallSniff: Enforces function call to be splitted to more lines so each parameter is on its own lineDeprecatedAnnotationDeclarationSniff: Reports@deprecatedannotations without description (thanks to @gmponos)SuperfluousErrorNamingSniff: Reports use of superfluous suffixErrorfor errors (thanks to @gmponos)
🔧 Improvements
- All sniffs should work on PHP 8 if you don't use new syntax - new syntax has to be supported by PHPCS first
- Support for
class-stringtype hint DuplicateSpacesSniff: New optionignoreSpacesInParametersInlineDocCommentDeclarationSniff: New optionallowAboveNonAssignmentReferenceUsedNamesOnlySniff: Less colisions withAlphabeticallySortedUsesSniff
🐛 Fixes
LanguageConstructWithParenthesesSniff: Some errors were not reported
⚠️ Deprecated
UnusedPrivateElementsSniff: Mark as deprecated
6.3.11
📣 You can now sponsor Slevomat Coding Standard development
Fixes
UselessVariableSniff: Fixed false positiveTraitUseSpacingSniff: Fix for uses with commentsUselessParenthesesSniff: Fixed false positiveRequireExplicitAssertionSniff: Fixed fixerDisallowArrayTypeHintSyntaxSniff: Fixed internal errorParentCallSpacingSniff: Fixed false positivesDisallowCommentAfterCodeSniff: Fixed internal errorPropertySpacingSniff: Fixed internal errorPropertySpacingSniff: Fixed false positiveConstantSpacingSniff: Fixed false positiveRequireTernaryOperatorSniff: Prevent introducing logic errors (thanks to @Khartir)ScopeHelper: Fixed internal error
Improvements
- Added
@phpstan-throwssupport
⚠️ Deprecated
UnusedPrivateElementsSniff: Mark as deprecated
6.3.10
📣 You can now sponsor Slevomat Coding Standard development
Fixes
UselessSemicolonSniff: Fixed internal errorUselessIfConditionWithReturnSniff: Don't remove comments automaticallyReferencedNameHelper: Fixed constant detection
6.3.9
📣 You can now sponsor Slevomat Coding Standard development
Fixes
DisallowCommentAfterCodeSniff: Fixed false positive- Fix error message typos in NumericLiteralSeparator sniffs (thanks to @finwe)
UnusedVariableSniff: Fixed false positivesEarlyExitSniff: Fixed fixer for conditions with?:and??
6.3.8
📣 You can now sponsor Slevomat Coding Standard development
Fixes
- Fixed detection of some referenced names
6.3.7
6.3.6
📣 You can now sponsor Slevomat Coding Standard development
Fixes
UseSpacingSniff: Fixed internal errorsFullyQualifiedClassNameInAnnotationSniff: Fixed false positiveUnusedPrivateElementsSniff: Fixed missing reports for write-only properties with FQN native typehints