Skip to content

Releases: slevomat/coding-standard

6.0.1

09 Dec 14:15
6.0.1
263d3a9

Choose a tag to compare

Fixes

  • Fixed array shapes support
  • UselessVariableSniff: Variables with @phpstan-var or @psalm-var annotation are not reported as useless
  • UselessParenthesesSniff: Fixed false positive

6.0.0

05 Dec 07:01
6.0.0
85e3329

Choose a tag to compare

New sniffs

  • RequireArrowFunctionSniff: Requires arrow functions
  • DisallowArrowFunctionSniff: Disallows arrow functions
  • RequireNumericLiteralSeparatorSniff: Requires use of numeric literal separators
  • DisallowNumericLiteralSeparatorSniff: Disallows numeric literal separators
  • RequireNowdocSniff: Requires nowdoc syntax instead of heredoc when possible
  • ReferenceSpacingSniff: Enforces configurable number of spaces after reference
  • DisallowReferenceSniff: Disallows references
  • RequireExplicitAssertionSniff: Requires assertion via assert() instead of inline documentation comments.
  • ParameterTypeHintSniff: Previously part of TypeHintDeclarationSniff
  • PropertyTypeHintSniff: Previously part of TypeHintDeclarationSniff
  • ReturnTypeHintSniff: Previously part of TypeHintDeclarationSniff
  • UselessFunctionDocCommentSniff: Previously part of TypeHintDeclarationSniff
  • BlockControlStructureSpacingSniff: Previously part of ControlStructureSpacingSniff
  • JumpStatementsSpacingSniff: Previously part of ControlStructureSpacingSniff

Improvements

  • PHP 7.4 support
  • Arrow functions support
  • Array shapes in phpDocs support
  • PropertyTypeHintSniff: Support for native type hints
  • InlineDocCommentDeclarationSniff: Reports missing related variables or no assigment
  • InlineDocCommentDeclarationSniff: Added support for doccomments after variable definition
  • InlineDocCommentDeclarationSniff: Added support for list() and short list []
  • TrailingArrayCommaSniff: New option enableAfterHeredoc
  • DisallowMixedTypeHintSniff: Added suppress support
  • UselessParenthesesSniff: Reports more useless parentheses

Fixes

  • Fixed support of @method annotation
  • InlineDocCommentDeclarationSniff: Check really only inline doccomments
  • TrailingCommaInCallSniff: Some calls were not reported
  • UselessParenthesesSniff: Fixed false positive
  • NamespaceSpacingSniff: Fixed false positive
  • UselessSemicolonSniff: Fixed internal error
  • TypeNameMatchesFileNameSniff: Files without namespaces should be reported too
  • UseSpacingSniff: Don't report errors for use statements with comments right before or after
  • UselessVariableSniff: Fixed false positive
  • UselessParameterDefaultValueSniff: Fixed false positive
  • UnusedPrivateElementsSniff: Fixed false positive
  • UnusedUsesSniff: Better handle php open tags (thanks to @donatj)
  • RequireCombinedAssignmentOperatorSniff: Fixed false positive
  • UselessInheritDocCommentSniff: Fixed internal error
  • RequireShortTernaryOperatorSniff: Fix token overrun (thanks to @donatj)
  • Fix compatibility with non-Composer installs of PHPCS (thanks to @jrfnl)

⚠️BC breaks

  • TypeHintDeclarationSniff is dead, long live ParameterTypeHintSniff, PropertyTypeHintSniff, ReturnTypeHintSniff and UselessFunctionDocCommentSniff
  • ControlStructureSpacingSniff is dead, long live BlockControlStructureSpacingSniff and JumpStatementsSpacingSniff (thanks to @grongor)

5.0.4

22 Mar 19:34
5.0.4
287ac33

Choose a tag to compare

Fixes

  • EarlyExitSniff: Fixed false positive
  • ControlStructureSpacingSniff: Fixed false positive
  • UnusedVariableSniff: Fixed false positives

5.0.3

19 Mar 21:24
5.0.3
89877cc

Choose a tag to compare

Fixes

  • ControlStructureSpacingSniff: Fixed false positive

5.0.2

12 Mar 20:49
5.0.2
223f02b

Choose a tag to compare

Fixes

  • ControlStructureSpacingSniff: Fixed T_CASE and T_DEFAULT support
  • UselessParenthesesSniff: Fixed false positives
  • UnusedVariableSniff: Fixed false positive
  • ConditionHelper: Fixed getNegativeCondition()
  • TypeHintHelper: Added more unofficial type hints

5.0.1

27 Feb 14:05
5.0.1
777ab18

Choose a tag to compare

Fixes

  • DisallowArrayTypeHintSyntaxSniff: Follow type hint when converting to generics syntax (thanks to @thewilkybarkid)
  • UnusedVariableSniff: Fixed false positive
  • UselessVariableSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positive
  • TypeHintDeclarationSniff: Invalid annotations should be ignored

Improvements

  • UseStatementHelper: Speedup
  • UseStatementHelper: Mark method getUseStatements() as deprecated

5.0.0

06 Feb 07:53
5.0.0
fdab228

Choose a tag to compare

New sniffs

  • SpreadOperatorSpacingSniff: Enforces configurable number of spaces after the ... operator
  • DisallowArrayTypeHintSyntaxSniff: Disallows usage of array type hint syntax (eg. int[], bool[][]) in phpDocs in favour of generic type hint syntax (eg. array<int>, array<array<bool>>)
  • TrailingCommaInCallSniff: Enforces trailing commas in multi-line calls
  • DisallowMixedTypeHintSniff: Disallows usage of "mixed" type hint in phpDocs
  • SuperfluousTraitNamingSniff: Reports use of superfluous suffix Trait for traits

Improvements

  • Added support for generic and intersection types in PHP docs
  • Improved support for more namespaces in a file
  • UselessIfConditionWithReturnSniff: New option assumeAllConditionExpressionsAreAlreadyBoolean
  • EarlyExitSniff: More useless elseif and else conditions are reported
  • NullTypeHintOnLastPositionSniff: Added support for @property and @method annotations
  • FullyQualifiedClassNameInAnnotationSniff: Added support for @property and @method annotations
  • LongTypeHintsSniff: Added support for @property and @method annotations
  • LongTypeHintsSniff: Inline doccomments are checked now
  • ReferenceUsedNamesOnlySniff: Added support for @method annotations (thanks to @hranicka)
  • UselessParenthesesSniff: Some useless parentheses were not reported

Fixes

  • OptimizedFunctionsWithoutUnpackingSniff: Fix for trailing commas in function calls
  • UnusedVariableSniff: Fixed false positive
  • UselessVariableSniff: Fixed false positive

⚠️BC breaks

  • EmptyLinesAroundTypeBracesSniff: Renamed to EmptyLinesAroundClassBracesSniff and moved to namespace Classes
  • DisallowEqualOperatorsSniff: Moved to namespace Operators
  • UselessConditionWithReturnSniff: Splitted to UselessIfConditionWithReturnSniff and UselessTernaryOperatorSniff
  • Removed support for @var annotation in format /** @var $variable type */ for most of the sniffs
  • Removed support for @param annotations without parameter name for most of the sniffs
  • AlphabeticallySortedUsesSniff: psr12Compatible option is now enabled by default
  • NullableTypeForNullDefaultValueSniff: Removed deprecated enabled option
  • ClassConstantVisibilitySniff: Removed deprecated enabled option
  • TypeHintDeclarationSniff: Mark enableObjectTypeHint option as deprecated
  • TypeHintDeclarationSniff: Removed deprecated usefulAnnotations option
  • TypeHintDeclarationSniff: Removed deprecated enableNullableTypeHints option
  • TypeHintDeclarationSniff: Removed deprecated enableVoidTypeHint option
  • Removed deprecated DisallowLateStaticBindingForContantsSniff (alias for DisallowLateStaticBindingForConstantsSniff)

4.8.7

03 Jan 13:50
4.8.7
bff9631

Choose a tag to compare

⚠️ PHPCS 3.4+ is now required (thanks to @carusogabriel)

Fixes:

  • DeclareStrictTypesSniff: Fixed correct number of whitespaces in autofix and errormessage (thanks to @wietsewarendorff)
  • RequireMultiLineTernaryOperatorSniff: Fixed close tag w/o prior semi (thanks to @donatj)
  • UnusedPrivateElementsSniff: Fixed false positive
  • SuperfluousExceptionNamingSniff: Fixed false positive
  • ControlStructureSpacingSniff: Fixed internal errors
  • DocCommentSpacingSniff: Fixed infinite loop
  • DisallowYodaComparisonSniff: Don't fix assigment in condition
  • RequireOnlyStandaloneIncrementAndDecrementOperatorsSniff: Fixed false positive
  • UnusedVariableSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positive
  • ReferencedNameHelper: Fixed reference names with whitespace

4.8.6

03 Nov 21:35
4.8.6
af0c0c9

Choose a tag to compare

⚠️ PHPCS 3.3.1+ is now required for PHP 7.3 compatibility.

Fixes:

  • UnusedVariableSniff: Fixed false positives
  • UnusedPrivateElementsSniff: Fixed false positives
  • UselessParenthesesSniff: Fixed false positives
  • TraitUseSpacingSniff: Fixer should not remove useful code
  • NamespaceDeclarationSniff: Fixed false positive
  • RequireOneNamespaceInFileSniff: Fixed false positive
  • ControlStructureSpacingSniff: Fixed false positive
  • UnusedUsesSniff: Fixed false positive
  • RequireMultiLineTernaryOperatorSniff: Fixed false positive
  • OptimizedFunctionsWithoutUnpackingSniff: Fixed infinite loop

4.8.5

05 Oct 13:07
4.8.5
057f3f1

Choose a tag to compare

Fixes:

  • UnusedVariableSniff: Fixed false positive
  • DisallowImplicitArrayCreationSniff: Fixed false positive
  • DisallowImplicitArrayCreationSniff: Fixed missing reporting
  • UselessParenthesesSniff: Fixed false positives
  • UselessParenthesesSniff: Fixed internal error