Skip to content

Releases: slevomat/coding-standard

6.2.0

30 Mar 07:58
6.2.0
c4bf9ca
Compare
Choose a tag to compare

📣 You can now sponsor Slevomat Coding Standard development

New sniffs

  • ArrowFunctionDeclaration: Checks fn declaration
  • MethodSpacingSniff: Checks that there is a certain number of blank lines between methods
  • DisallowMultiConstantDefinitionSniff: Disallows multi constant definition
  • DisallowMultiPropertyDefinitionSniff: Disallows multi property definition
  • DisallowDirectMagicInvokeCallSniff: Disallows direct call of __invoke()
  • DisallowSuperGlobalVariableSniff: Disallows use of super global variables
  • DisallowInlineCommentAfterCodeSniff: Disallows comments after code at the same line
  • DuplicateSpacesSniff: Checks duplicate spaces anywhere

Improvements

  • InlineDocCommentDeclarationSniff: New option allowDocCommentAboveReturn
  • EarlyExitSniff: New option ignoreOneLineTrailingIf
  • FullyQualifiedGlobalConstantsSniff: New option include (thanks to @bbatsche)
  • FullyQualifiedGlobalFunctionsSniff: New option include (thanks to @bbatsche)
  • FullyQualifiedGlobalFunctionsSniff: New option includeSpecialFunctions
  • RequireYodaComparisonSniff: New option alwaysVariableOnRight
  • JumpStatementsSpacingSniff: New options linesCountBeforeWhenFirstInCaseOrDefault, linesCountAfterWhenLastInCaseOrDefault and linesCountAfterWhenLastInLastCaseOrDefault
  • ClassStructureSniff: New option enableFinalMethods to support final methods groups
  • RequireNullCoalesceEqualOperatorSniff: New option enable (thanks to @carusogabriel)
  • TrailingCommaInCallSniff: New option enable (thanks to @carusogabriel)
  • RequireArrowFunctionSniff: New option enable (thanks to @carusogabriel)
  • RequireNumericLiteralSeparatorSniff: New option enable (thanks to @carusogabriel)
  • RequireNumericLiteralSeparatorSniff: New option minDigitsBeforeDecimalPoint
  • RequireNumericLiteralSeparatorSniff: New option minDigitsAfterDecimalPoint
  • ClassStructureSniff: Support for shortcut groups
  • ReferenceThrowableOnlySniff: Can be suppressed when \Exception is used as parameter
  • ParameterTypeHintSniff: @psalm-param and @phpstan-param are sufficient as type hints
  • ReturnTypeHintSniff: @psalm-return and @phpstan-return are sufficient as type hints
  • PropertyTypeHintSniff: @psalm-var and @phpstan-var are sufficient as type hints
  • RequireNullCoalesceOperatorSniff: Improved fixer
  • PropertyTypeHintSniff: Improved performance
  • PropertyTypeHintSpacingSniff: Improved performance
  • UnusedUsesSniff: Improved performance (thanks to @nightlinus)
  • UnusedVariableSniff: Improved performance (thanks to @nightlinus)
  • FullyQualifiedExceptionsSniff: Improved performance
  • ReferenceUsedNamesOnlySniff: Improved performance
  • FullyQualifiedGlobalConstantsSniff: Improved performance
  • FullyQualifiedGlobalFunctionsSniff: Improved performance
  • Support for PHPCS configuration php_version in all possible sniffs
  • NamespaceHelper: Improved performance (thanks to @nightlinus)

Fixes

  • PropertySpacingSniff: Fixed false positive
  • JumpStatementsSpacingSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positive
  • UnusedVariableSniff: Fixed false positives
  • EarlyExitSniff: Fixed false positives
  • InlineDocCommentDeclarationSniff: Fixed false positives
  • BlockControlStructureSpacingSniff: Fixed false positive
  • NegationOperatorSpacingSniff: Fixed internal error
  • ReturnTypeHintSniff: Fixed breaking syntax on removing useless @return annotation in one-line doccomment (thanks to @nightlinus)
  • ParameterTypeHintSniff: Fixed breaking syntax on removing useless @param annotation in one-line doccomment
  • ForbiddenAnnotationsSniff: Fixed fixer for one-line doccomments
  • InlineDocCommentDeclarationSniff: Added support for various spacings in callable typehint (thanks to @simPod)
  • PropertySpacingSniff: Fixed fixer
  • UnusedUsesSniff: Fix for duplicate errors
  • AlphabeticallySortedUsesSniff: Fix for duplicate errors
  • ReferenceThrowableOnlySniff: Fix for duplicate errors
  • FullyQualifiedGlobalConstantsSniff: Fix for duplicate errors
  • FullyQualifiedGlobalFunctionsSniff: Fix for duplicate errors
  • FullyQualifiedExceptionsSniff: Fix for duplicate errors
  • ReferenceUsedNamesOnlySniff: Fix for duplicate errors
  • UselessAliasSniff: Fix for duplicate errors
  • UseSpacingSniff: Fix for duplicate errors
  • UseStatementHelper: Workaround for bug in PHPCS

6.1.5

06 Feb 11:28
6.1.5
d767b5e
Compare
Choose a tag to compare

You can now sponsor Slevomat Coding Standard development

Fixes

  • EarlyExitSniff: Improved fixer
  • ClassStructureSniff: Fixed detection of some magic methods
  • ClassStructureSniff: Require all groups to be set (thanks to @grongor)
  • ClassStructureSniff: Improve violation message (thanks to @grongor)
  • Fixes for typed properties

6.1.4

03 Feb 21:54
6.1.4
49e6021
Compare
Choose a tag to compare

You can now sponsor Slevomat Coding Standard development

Fixes

  • PropertySpacingSniff: Fixed support for typed properties
  • ParameterTypeHintSniff: Fixed false positives
  • PropertyTypeHintSniff: Fixed false positives
  • ReturnTypeHintSniff: Fixed false positives
  • EarlyExitSniff: Fixed fixer for heredoc/nowdoc

6.1.3

01 Feb 17:59
6.1.3
c8f2e2b
Compare
Choose a tag to compare

You can now sponsor Slevomat Coding Standard development

Fixes

  • ParameterTypeHintSniff: Fixed false positives
  • ReturnTypeHintSniff: Fixed false positives
  • PropertyTypeHintSniff: Fixed false positives

6.1.2

01 Feb 16:12
6.1.2
bb9db1a
Compare
Choose a tag to compare

You can now sponsor Slevomat Coding Standard development

Fixes

  • SingleLineArrayWhitespaceSniff: Fixed settings by XML configuration (thanks to @mcaskill)
  • UselessParenthesesSniff: Fixed false positive
  • ParentCallSpacingSniff: Fixed false positive
  • PropertySpacingSniff: Fixed settings by XML configuration (thanks to @paxal)
  • ConstantSpacingSniff: Fixed settings by XML configuration (thanks to @paxal)
  • PropertySpacingSniff: Fixed false positive
  • ConstantSpacingSniff: Fixed false positive
  • UnusedPrivateElementsSniff: Fixed support for private typed properties (thanks to @paxal)
  • ParameterTypeHintSniff: Fixed support for union and nullable types
  • ReturnTypeHintSniff: Fixed support for union and nullable types
  • PropertyTypeHintSniff: Fixed support for union and nullable types

Improvements

  • SingleLineArrayWhitespaceSniff: Add empty array support (can be enabled with new option enableEmptyArrayCheck) (thanks to @mcaskill)
  • TraitUseSpacingSniff: Added additional setting linesCountBeforeFirstUseWhenFirstInClass (thanks to @thled)
  • RequireSingleLineMethodSignatureSniff: New option includedMethodPatterns (thanks to @RiKap)
  • RequireSingleLineMethodSignatureSniff: New option excludedMethodPatterns (thanks to @RiKap)
  • RequireMultiLineMethodSignatureSniff: New option includedMethodPatterns (thanks to @RiKap)
  • RequireMultiLineMethodSignatureSniff: New option excludedMethodPatterns (thanks to @RiKap)

6.1.1

23 Jan 16:34
6.1.1
0a7934d
Compare
Choose a tag to compare

You can now sponsor Slevomat Coding Standard development

Fixes

  • ParentCallSpacingSniff: Fixed false positive (thanks to @grongor)
  • RequireSingleLineMethodSignatureSniff: Fix for semicolons (thanks to @grongor)
  • PropertyTypeHintSniff: Improved support for union types
  • ReturnTypeHintSniff: Improved support for union types
  • ParameterTypeHintSniff: Improved support for union types
  • ClassStructureSniff: Fix missing support for static abstract methods (thanks to @grongor)

Improvements

  • NullableTypeForNullDefaultValueSniff: Allow suppress (thanks to @simPod)

6.1.0

20 Jan 08:59
6.1.0
2f5e010
Compare
Choose a tag to compare

You can now sponsor Slevomat Coding Standard development

New sniffs

  • RequireNullCoalesceEqualOperatorSniff: Requires use of null coalesce equal operator when possible
  • RequireMultiLineMethodSignatureSniff: Enforces method signature to be splitted to more lines so each parameter is on its own line
  • RequireSingleLineMethodSignatureSniff: Enforces method signature to be on a single line (thanks to @grongor)
  • PropertySpacingSniff: Checks that there is a certain number of blank lines between properties (thanks to @grongor)
  • ConstantSpacingSniff: Checks that there is a certain number of blank lines between constants (thanks to @grongor)
  • ParentCallSpacingSniff: Enforces configurable number of lines around parent method call (thanks to @grongor)
  • ClassStructureSniff: Checks that class/trait/interface members are in the correct order (thanks to @grongor)
  • RequireOneLineDocCommentSniff: Requires comments with single-line content to be written as one-liners (thanks to @grongor)
  • MultiLineArrayEndBracketPlacementSniff: Enforces reasonable end bracket placement for multiline arrays (thanks to @grongor)
  • SingleLineArrayWhitespaceSniff: Checks whitespace in single line array declarations (thanks to @grongor)
  • NegationOperatorSpacingSniff: Checks if there is the same number of spaces after negation operator as expected (thanks to @grongor)
  • LineLengthSniff: Enforces maximum length of a single line of code (thanks to @grongor)
  • DisallowEmptyFunctionSniff: Reports empty functions body and require at least a comment inside (thanks to @arxeiss)

Improvements

  • UnusedPrivateElementsSniff: New option alwaysUsedMethodsAnnotations (thanks to @simPod)
  • Don't break the complete PHPCS run for unsupported syntaxes (thanks to @jrfnl)

Fixes

  • FullyQualifiedGlobalConstantsSniff: Fixed false positives
  • FullyQualifiedGlobalFunctionsSniff: Fixed false positives
  • UnusedVariableSniff: Fixed false positive
  • UselessVariableSniff: Fixed false positives
  • RequireTernaryOperatorSniff: Fixed false positives (thanks to @grongor)
  • JumpStatementsSpacingSniff: Fixed false positives (thanks to @grongor)
  • NullableTypeForNullDefaultValueSniff: Workaround for bug in PHPCS

6.0.8

14 Jan 08:52
6.0.8
dd399a5
Compare
Choose a tag to compare

Fixes

  • ReferenceUsedNamesOnlySniff: Fixed missing reports
  • ReferenceUsedNamesOnlySniff: Fixed false positive

6.0.7

12 Jan 20:33
6.0.7
2731353
Compare
Choose a tag to compare

Fixes

  • InlineDocCommentDeclarationSniff: Fixed false positives

6.0.6

09 Jan 19:56
6.0.6
3cc9f2f
Compare
Choose a tag to compare

Fixes

  • StaticClosureSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positive
  • JumpStatementsSpacingSniff: Fix yield inside function calls
  • DocCommentSpacingSniff: Fixed support for @phpstan and @phpcs annotations