github slevomat/coding-standard 7.0.0

latest releases: 8.15.0, 8.14.1, 8.14.0...
3 years ago

🆕 New sniffs

  • RequireNonCapturingCatchSniff: Requires non-capturing catch when the variable with exception is not used
  • RequireNullSafeObjectOperatorSniff: Requires using ?-> operator
  • DisallowNullSafeObjectOperatorSniff: Disallows using ?-> operator
  • RequireTrailingCommaInDeclarationSniff: Enforces trailing commas in multi-line declarations
  • DisallowTrailingCommaInDeclarationSniff: Disallows trailing commas in multi-line declarations
  • RequireConstructorPropertyPromotionSniff: Requires use of constructor property promotion
  • DisallowConstructorPropertyPromotionSniff: Disallows usage of constructor property promotion
  • UnionTypeHintFormatSniff: Checks format of union type hints
  • DisallowNamedArgumentsSniff: Disallows usage of named arguments
  • DisallowTrailingCommaInCallSniff: Disallows trailing commas in multi-line calls
  • ForbiddenPublicPropertySniff: Disallows using public properties (thanks to @50bhan)
  • FunctionLengthSniff: Disallows long function (thanks to @50bhan)

🔧 Improvements

  • Support for union type hints
  • Support for mixed and static type hint
  • Support for @phpstan-type, @psalm-type, @phpstan-import-type and @psalm-import-type annotations
  • ReturnTypeHintSniff: New option enableUnionTypeHint to enable support for union type hints
  • PropertyTypeHintSniff: New option enableUnionTypeHint to enable support for union type hints
  • ParameterTypeHintSniff: New option enableUnionTypeHint to enable support for union type hints
  • ReturnTypeHintSniff: New option enableMixedTypeHint to enable support for mixed type hint
  • PropertyTypeHintSniff: New option enableMixedTypeHint to enable support for mixed type hint
  • ParameterTypeHintSniff: New option enableMixedTypeHint to enable support for mixed type hint
  • ReturnTypeHintSniff: New option enableStaticTypeHint to enable support for static type hint
  • ReturnTypeHintSniff: Reports useless @phpcsSuppress
  • ParameterTypeHintSniff: Reports useless @phpcsSuppress
  • PropertyTypeHintSniff: Reports useless @phpcsSuppress
  • UnusedParameterSniff: Reports useless @phpcsSuppress
  • ModernClassNameReferenceSniff: New option enableOnObjects to enable ::class on all objects
  • NullableTypeForNullDefaultValueSniff: Support for mixed and union type hints
  • ReferenceUsedNamesOnlySniff: Improved fixer
  • BlockControlStructureSpacingSniff: Ignore if with alternative syntax
  • RequireTernaryOperatorSniff: Improved fixer
  • RequireMultiLineTernaryOperatorSniff: Support for more ternary operators
  • RequireMultiLineTernaryOperatorSniff: New option expressionsMinLength
  • BlockControlStructureSpacingSniff: Improved behaviour for case and default control structures
  • JumpStatementsSpacingSniff:: No errors for throw expressions

🐛 Fixes

  • NegationOperatorSpacingSniff: Fixed false positive
  • BlockControlStructureSpacingSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positives
  • JumpStatementsSpacingSniff: Fixed false positive
  • RequireCombinedAssignmentOperatorSniff: Possible string offset should only report error - fixer is disabled to prevent fatal errors
  • NegationOperatorSpacing: Fix for magic constants (thanks to @carusogabriel)
  • RequireMultiLineTernaryOperatorSniff: Fixed false positives
  • RequireShortTernaryOperatorSniff: Fixed false positive
  • ReferenceUsedNamesOnlySniff: Fixed problem with incorrect case
  • StrictCallSniff: Fixed false positive
  • EarlyExitSniff: Fixed false positives
  • DeclareStrictTypesSniff: Fixer should not remove comment before
  • AlphabeticallySortedUsesSniff: Fixer should not remove comment before use
  • ClassStructureSniff: Fixed internal error

⚠️BC breaks

  • PropertyTypeHintSpacingSniff: Removed CODE_NO_SPACE_BEFORE_TYPE_HINT because it's not possible on PHP 8
  • DeclareStrictTypesSniff: Options renamed and modifed, see README
  • TrailingCommaInCallSniff renamed to RequireTrailingCommaInCallSniff
  • Removed deprecated UnusedPrivateElementsSniff
  • Removed FullyQualifiedClassNameAfterKeywordSniff
  • ReferenceUsedNamesOnlySniff: Removed option fullyQualifiedKeywords
  • BlockControlStructureSpacingSniff: Options renamed and modified, see README
  • JumpStatementsSpacingSniff: Options renamed and modified, see README
  • ParentCallSpacingSniff: Shorter options names, see README
  • All helpers are marked as internal
  • UselessFunctionDocCommentSniff: Removed suppress support

Don't miss a new coding-standard release

NewReleases is sending notifications on new releases.