Skip to content

Releases: slevomat/coding-standard

4.8.4

01 Oct 20:26
4.8.4
bc8a02f

Choose a tag to compare

Fixes:

  • ControlStructureSpacingSniff: Fixed reporting and fixer
  • ControlStructureSpacingSniff: Fixed internal error
  • UselessParenthesesSniff: Fixed false positives
  • UselessVariableSniff: Fixed false positive

4.8.3

26 Sep 06:42
4.8.3
32e1ca2

Choose a tag to compare

Fixes:

  • UnusedInheritedVariablePassedToClosureSniff: Fixed fixer
  • DocCommentSpacingSniff: Some errors were not reported and fixed
  • DocCommentSpacingSniff: Fixed internal error
  • RequireTernaryOperatorSniff: Fixed internal error

4.8.2

25 Sep 08:46
4.8.2
5e87870

Choose a tag to compare

Fixes:

  • DocCommentSpacingSniff: Some errors were not reported and fixed
  • DocCommentSpacingSniff: Fixed fixer
  • DocCommentSpacingSniff: Fixed internal error
  • StaticClosureSniff: Fixed false positive

4.8.1

24 Sep 10:55
4.8.1
f74119f

Choose a tag to compare

Fixes:

  • ControlStructureSpacingSniff: Fixed internal error
  • DisallowLateStaticBindingForConstantsSniff: Fixed typo in sniff name (previous name still works)

4.8.0

20 Sep 07:07
4.8.0
7b33fb1

Choose a tag to compare

⚠️ PHPCS 3.3.0+ is now required.

New sniffs:

  • RequireOnlyStandaloneIncrementAndDecrementOperatorsSniff: Reports ++ and -- operators not used standalone
  • UselessParameterDefaultValueSniff: Looks for useless parameter default value
  • DisallowLateStaticBindingForContantsSniff: Disallows late static binding for constants
  • UselessLateStaticBindingSniff: Reports useless late static binding
  • ControlStructureSpacingSniff: Enforces configurable number of lines around control structures
  • UselessConditionWithReturnSniff: Reports useless conditions where both branches return true or false
  • RequireTernaryOperatorSniff: Requires ternary operator when possible
  • RequireMultiLineTernaryOperatorSniff: Ternary operator has to be reformatted to more lines when the line length exceeds the given limit
  • DisallowImplicitArrayCreationSniff: Disallows implicit array creation
  • DuplicateAssignmentToVariableSniff: Looks for duplicate assignments to a variable
  • DisallowContinueWithoutIntegerOperandInSwitchSniff: Disallows use of continue without integer operand in switch because it's emits warning in PHP 7.3 and higher
  • OptimizedFunctionsWithoutUnpackingSniff: Reports functions that should not be invoked with argument unpacking because of opcache optimizations (thanks to @Majkl578)

Improvements:

  • DocCommentSpacingSniff: New options linesCountBetweenAnnotationsGroups and annotationsGroups
  • UselessParenthesesSniff: New option ignoreComplexTernaryConditions
  • UnusedVariableSniff: New option ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach
  • EarlyExitSniff: New option ignoreStandaloneIfInScope
  • ShortListSniff: Improved fixer

Fixes:

  • EarlyExitSniff: Fixed false positive
  • UnusedVariableSniff: Fixed false positives
  • UselessParenthesesSniff: Fixed false positive
  • ModernClassNameReferenceSniff: Fixed fixer
  • RequireShortTernaryOperatorSniff: Infinite loop fix (thanks to @dg)
  • ReferenceUsedNamesOnlySniff: Possible fix of false positives
  • DisallowIncrementAndDecrementOperatorsSniff: Fixed error codes for post operators in some situations
  • IdentificatorHelper: A lot of fixes

4.7.3

03 Sep 21:15
4.7.3
360ed8f

Choose a tag to compare

Fixes:

  • ModernClassNameReferenceSniff: Fixed false positives
  • UnusedVariableSniff: Fixed false positive
  • UselessVariableSniff: Fixed false positives

4.7.2

30 Aug 21:35
4.7.2
d6d531b

Choose a tag to compare

Fixes:

  • ReferenceUsedNamesOnlySniff: Fixed false positives
  • RequireShortTernaryOperatorSniff: Fixed false positive
  • StaticClosureSniff: Fixed false positive
  • ModernClassNameReferenceSniff: Fixed fixer
  • UnusedParameterSniff: Fixed false positive
  • UnusedVariableSniff: Fixed false positive
  • UselessInheritDocCommentSniff: Fixed false positives
  • UselessParenthesesSniff: Fixed false positive

4.7.1

29 Aug 20:48
4.7.1
4879172

Choose a tag to compare

Fixes:

  • UnusedParameterSniff: Fixed false positive
  • UnusedVariableSniff: Fixed false positives
  • UnusedInheritedVariablePassedToClosure: Fixed false positives
  • RequireNullCoalesceOperatorSniff: Fixed false positives
  • ModernClassNameReferenceSniff: Fixed false positives with get_class()
  • ModernClassNameReferenceSniff: Fixed error messages
  • UselessVariableSniff: Fixed false positive
  • UselessParenthesesSniff: Fixed false positives
  • UselessParenthesesSniff: Fixed checks for parentheses around "case"

4.7.0

24 Aug 23:08
4.7.0
51be382

Choose a tag to compare

New sniffs:

  • ModernClassNameReferenceSniff: Reports use of __CLASS__, get_parent_class(), get_called_class(), get_class() and get_class($this). Class names should be referenced via ::class contant when possible
  • StaticClosureSniff: Reports closures not using $this that are not declared static
  • RequireCombinedAssignmentOperatorSniff: Requires using combined assigment operators, eg +=, .= etc
  • NullTypeHintOnLastPositionSniff: Enforces null type hint on last position in @var, @param and @return annotations
  • UselessConstantTypeHint: Reports useless @var annotation (or whole documentation comment) for class constants because the type of constant is always clear
  • UselessInheritDocCommentSniff: Reports documentation comments containing only {@inheritDoc} annotation because inheritance is automatic and it's not needed to use a special annotation for it
  • TraitUseDeclarationSniff: Prohibits multiple traits separated by commas in one use statement
  • TraitUseSpacingSniff: Enforces configurable number of lines before first use, after last use and between two use statements
  • UnusedVariableSniff: Looks for unused variables
  • UselessVariableSniff: Looks for useless variables
  • UnusedParameterSniff: Looks for unused parameters
  • UnusedInheritedVariablePassedToClosureSniff: Looks for unused inherited variables passed to closure via use
  • UselessAliasSniff: Looks for use alias that is same as unqualified name
  • UselessSemicolonSniff: Looks for useless semicolons
  • UselessParenthesesSniff: Looks for useless parentheses
  • NewWithoutParenthesesSniff: Reports new with useless parentheses

Improvements:

  • RequireNullCoalesceOperatorSniff: === null and !== null conditions are detected too
  • RequireShortTernaryOperatorSniff: Works with properties too

Fixes:

  • UnusedUsesSniff: Fixed false positives for classes used in @see annotation
  • FullyQualifiedClassNameInAnnotationSniff: Fixed fixer
  • NamespaceSpacingSniff: Fixed false positive when phpcs comment is before namespace

4.6.3

29 Jun 21:00
4.6.3
76e31b7

Choose a tag to compare

Fixes:

  • UnusedPrivateElementsSniff: Fixed alwaysUsedPropertiesAnnotations support of prefixes
  • UnusedPrivateElementsSniff: Fixed false positive with constant in string
  • LongTypeHintsSniff: Fixer should be case insensitive
  • TypeHintDeclarationSniff: Added missing @inheritdoc support for properties