Skip to content

Releases: slevomat/coding-standard

7.0.5

20 Apr 12:48
7.0.5
35e0235
Compare
Choose a tag to compare

🐛 Fixes

  • RequireNullSafeObjectOperatorSniff: Fixed false positives
  • UselessParenthesesSniff: Fixed false positive

7.0.4

19 Apr 07:31
7.0.4
5a78b78
Compare
Choose a tag to compare

🐛 Fixes

  • RequireConstructorPropertyPromotionSniff: Fixed false positive
  • BlockControlStructureSpacingSniff: Fixed false positive

7.0.3

16 Apr 12:12
7.0.3
ce75dc2
Compare
Choose a tag to compare

🐛 Fixes

  • DisallowEmptyFunctionSniff: Fixed false positive
  • RequireNonCapturingCatchSniff: Improved fixer

7.0.2

14 Apr 18:23
7.0.2
7815b13
Compare
Choose a tag to compare

🐛 Fixes

  • ParameterTypeHintSniff: Fixed false positive
  • PropertyTypeHintSniff: Fixed false positive
  • ReturnTypeHintSniff: Fixed false positive
  • NullableTypeForNullDefaultValueSniff: Fixed false positive

7.0.1

12 Apr 06:15
7.0.1
0858034
Compare
Choose a tag to compare

🐛 Fixes

  • DeclareStrictTypesSniff: Some errors were not reported
  • UnusedParameterSniff: Fixed false positive
  • RequireTrailingCommaInDeclarationSniff: Fixed false positive

7.0.0

09 Apr 08:21
7.0.0
b4922c5
Compare
Choose a tag to compare

🆕 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

6.4.1

05 Oct 12:46
6.4.1
696dcca
Compare
Choose a tag to compare

🐛 Fixes

  • NegationOperatorSpacingSniff: Fixed false positive
  • BlockControlStructureSpacingSniff: Fixed false positive
  • BlockControlStructureSpacingSniff: Ignore if with alternative syntax
  • JumpStatementsSpacingSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positive
  • ReferenceUsedNamesOnlySniff: Improved fixer
  • RequireTernaryOperatorSniff: Improved fixer

6.4.0

31 Aug 08:27
6.4.0
bf3a16a
Compare
Choose a tag to compare

📣 You can now sponsor Slevomat Coding Standard development

🆕 New sniffs

  • RequireSingleLineConditionSniff: Enforces conditions of if, elseif, while and do-while to be on a single line
  • RequireMultiLineConditionSniff: Enforces conditions of if, elseif, while and do-while with one or more boolean operators to be splitted to more lines so each condition part is on its own line
  • RequireSingleLineCallSniff: Enforces function call to be on a single line
  • RequireMultiLineCallSniff: Enforces function call to be splitted to more lines so each parameter is on its own line
  • DeprecatedAnnotationDeclarationSniff: Reports @deprecated annotations without description (thanks to @gmponos)
  • SuperfluousErrorNamingSniff: Reports use of superfluous suffix Error 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 option ignoreSpacesInParameters
  • InlineDocCommentDeclarationSniff: New option allowAboveNonAssignment
  • ReferenceUsedNamesOnlySniff: Less colisions with AlphabeticallySortedUsesSniff

🐛 Fixes

  • LanguageConstructWithParenthesesSniff: Some errors were not reported

⚠️Deprecated

  • UnusedPrivateElementsSniff: Mark as deprecated

6.3.11

25 Aug 16:26
6.3.11
4f7eb27
Compare
Choose a tag to compare

📣 You can now sponsor Slevomat Coding Standard development

Fixes

  • UselessVariableSniff: Fixed false positive
  • TraitUseSpacingSniff: Fix for uses with comments
  • UselessParenthesesSniff: Fixed false positive
  • RequireExplicitAssertionSniff: Fixed fixer
  • DisallowArrayTypeHintSyntaxSniff: Fixed internal error
  • ParentCallSpacingSniff: Fixed false positives
  • DisallowCommentAfterCodeSniff: Fixed internal error
  • PropertySpacingSniff: Fixed internal error
  • PropertySpacingSniff: Fixed false positive
  • ConstantSpacingSniff: Fixed false positive
  • RequireTernaryOperatorSniff: Prevent introducing logic errors (thanks to @Khartir)
  • ScopeHelper: Fixed internal error

Improvements

  • Added @phpstan-throws support

⚠️Deprecated

  • UnusedPrivateElementsSniff: Mark as deprecated

6.3.10

22 Jun 11:41
6.3.10
58fa5ea
Compare
Choose a tag to compare

📣 You can now sponsor Slevomat Coding Standard development

Fixes

  • UselessSemicolonSniff: Fixed internal error
  • UselessIfConditionWithReturnSniff: Don't remove comments automatically
  • ReferencedNameHelper: Fixed constant detection