🆕 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