Releases: slevomat/coding-standard
Releases · slevomat/coding-standard
7.0.5
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
🆕 New sniffs
RequireNonCapturingCatchSniff
: Requires non-capturingcatch
when 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
mixed
andstatic
type hint - Support for
@phpstan-type
,@psalm-type
,@phpstan-import-type
and@psalm-import-type
annotations ReturnTypeHintSniff
: New optionenableUnionTypeHint
to enable support for union type hintsPropertyTypeHintSniff
: New optionenableUnionTypeHint
to enable support for union type hintsParameterTypeHintSniff
: New optionenableUnionTypeHint
to enable support for union type hintsReturnTypeHintSniff
: New optionenableMixedTypeHint
to enable support formixed
type hintPropertyTypeHintSniff
: New optionenableMixedTypeHint
to enable support formixed
type hintParameterTypeHintSniff
: New optionenableMixedTypeHint
to enable support formixed
type hintReturnTypeHintSniff
: New optionenableStaticTypeHint
to enable support forstatic
type hintReturnTypeHintSniff
: Reports useless@phpcsSuppress
ParameterTypeHintSniff
: Reports useless@phpcsSuppress
PropertyTypeHintSniff
: Reports useless@phpcsSuppress
UnusedParameterSniff
: Reports useless@phpcsSuppress
ModernClassNameReferenceSniff
: New optionenableOnObjects
to enable::class
on all objectsNullableTypeForNullDefaultValueSniff
: Support formixed
and union type hintsReferenceUsedNamesOnlySniff
: Improved fixerBlockControlStructureSpacingSniff
: Ignoreif
with alternative syntaxRequireTernaryOperatorSniff
: Improved fixerRequireMultiLineTernaryOperatorSniff
: Support for more ternary operatorsRequireMultiLineTernaryOperatorSniff
: New optionexpressionsMinLength
BlockControlStructureSpacingSniff
: Improved behaviour forcase
anddefault
control structuresJumpStatementsSpacingSniff
:: No errors forthrow
expressions
🐛 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 beforeuse
ClassStructureSniff
: Fixed internal error
⚠️ BC breaks
PropertyTypeHintSpacingSniff
: RemovedCODE_NO_SPACE_BEFORE_TYPE_HINT
because it's not possible on PHP 8DeclareStrictTypesSniff
: Options renamed and modifed, see READMETrailingCommaInCallSniff
renamed toRequireTrailingCommaInCallSniff
- Removed deprecated
UnusedPrivateElementsSniff
- Removed
FullyQualifiedClassNameAfterKeywordSniff
ReferenceUsedNamesOnlySniff
: Removed optionfullyQualifiedKeywords
BlockControlStructureSpacingSniff
: 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
: Ignoreif
with 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
,while
anddo-while
to be on a single lineRequireMultiLineConditionSniff
: Enforces conditions ofif
,elseif
,while
anddo-while
with 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@deprecated
annotations without description (thanks to @gmponos)SuperfluousErrorNamingSniff
: Reports use of superfluous suffixError
for 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-string
type hint DuplicateSpacesSniff
: New optionignoreSpacesInParameters
InlineDocCommentDeclarationSniff
: New optionallowAboveNonAssignment
ReferenceUsedNamesOnlySniff
: 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-throws
support
⚠️ 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