Skip to content

Releases: slevomat/coding-standard

5.0.0

06 Feb 07:53
5.0.0
fdab228
Compare
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
Compare
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
Compare
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
Compare
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

4.8.4

01 Oct 20:26
4.8.4
bc8a02f
Compare
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
Compare
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
Compare
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
Compare
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
Compare
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
Compare
Choose a tag to compare

Fixes:

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