Skip to content

Releases: slevomat/coding-standard

4.7.2

30 Aug 21:35
4.7.2
d6d531b
Compare
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
Compare
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
Compare
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
Compare
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

4.6.2

12 Jun 21:38
4.6.2
d43b9a6
Compare
Choose a tag to compare

Fixes:

  • EarlyExitSniff: Added missing yield from support
  • LanguageConstructWithParenthesesSniff: Added missing yield from check
  • FunctionHelper: Added missing yield from detection if function returns value

4.6.1

11 Jun 19:29
4.6.1
de4a6fe
Compare
Choose a tag to compare

Compatibility with PHPCS 3.3

Fixes:

  • ReferenceUsedNamesOnlySniff: Fixed fixer for classes in doccomments
  • DisallowEqualOperatorsSniff: Fixed message when operator is <> (thanks to @carusogabriel)

4.6.0

15 May 21:36
4.6.0
95436f1
Compare
Choose a tag to compare

New sniffs:

  • NamespaceDeclarationSniff: Enforces one space after namespace, disallows content between namespace name and semicolon and disallows use of bracketed syntax
  • NamespaceSpacingSniff: Enforces configurable number of lines before and after namespace
  • RequireOneNamespaceInFileSniff: Requires only one namespace in a file
  • DisallowIncrementAndDecrementOperatorsSniff: Disallows using ++ and -- operators
  • RequireShortTernaryOperatorSniff: Requires short ternary operator ?: when possible
  • DisallowShortTernaryOperatorSniff: Disallows short ternary operator ?:
  • DisallowEmptySniff: Disallows use of empty()
  • ShortListSniff: Enforces using short form of list syntax, [...] instead of list(...) (thanks to @Majkl578)

Improvements:

  • InlineDocCommentDeclarationSniff: Reports empty @var annotations
  • InlineDocCommentDeclarationSniff: Reports invalid comment type used for inline documentation comment
  • InlineDocCommentDeclarationSniff: Reports doccomment above foreach and while as well
  • UseSpacingSniff: Enforce zero number of lines between same types of use statement
  • UnusedUsesSniff: ignoredAnnotations - Case sensitive list of annotation names that the sniff ignore completely (both name and content are ignored)
  • TypeHintDeclarationSniff: allAnnotationsAreUseful - Doccomment is useful if it contain any annotation, option usefulAnnotations is deprecated
  • UnusedPrivateElementsSniff: alwaysUsedPropertiesAnnotations supports prefixes
  • UnusedUsesSniff: Improved @method annotation parsing

Fixes:

  • EarlyExitSniff: Fixed notices
  • EarlyExitSniff: Fixed fixer for complicated logical conditions
  • UnusedUsesSniff: Fixed false positives
  • UnusedPrivateElementsSniff: Fixed false positive when property used in new
  • ReferencedNameHelper: goto label should not be resolved as constant
  • TypeHelper: Fixed regexp

4.5.2

08 Mar 08:16
4.5.2
1e60915
Compare
Choose a tag to compare

Fixes:

  • TypeHintDeclarationSniff: Return annotation is not useless when return type hint is missing

4.5.1

06 Mar 08:12
4.5.1
1741355
Compare
Choose a tag to compare

Fixes:

  • EmptyCommentSniff: Empty comments in multiline commented code are not reported
  • ReferencedNameHelper: Global constant used in class constant definition was not detected

4.5.0

02 Mar 15:42
4.5.0
3957603
Compare
Choose a tag to compare

⚠️ PHPCS 3.2.3+ is now required.

New sniffs:

  • SuperfluousExceptionNamingSniff: Reports usage of superfluous suffix Exception for exceptions
  • SuperfluousAbstractClassNamingSniff: Reports usage of superfluous prefix or suffix Abstract for abstract classes
  • SuperfluousInterfaceNamingSniff: Reports usage of superfluous prefix or suffix Interface for interfaces
  • UseSpacingSniff: Enforces configurable number of lines before first use, after last use and between two different types of use (eg. between use function and use const)
  • EmptyCommentSniff: Reports empty comments
  • DocCommentSpacing: Enforces configurable number of lines before first content (description or annotation), after last content (description or annotation), between description and annotations, between two different annotations types
  • DisallowOneLinePropertyDocCommentSniff: Require comments with single-line content to be written as multi-liners (thanks to @Majkl578)
  • RequireOneLinePropertyDocCommentSniff: Require comments with single-line content to be written as one-liners (thanks to @Majkl578)
  • TypeCastSniff: Enforces using shorthand cast operators, forbids use of unset and binary cast operators (thanks to @Majkl578)

Improvements:

  • EarlyExitSniff: New check "Remove useless elseif to reduce code nesting"
  • UnusedUsesSniff: ignoredAnnotationNames - To ignore specified annotation names (thanks to @xificurk)
  • ReferenceUsedNamesOnlySniff: Improved annotations parsing
  • FullyQualifiedClassNameInAnnotationSniff: Improved annotations parsing
  • ForbiddenAnnotationsSniff: Improved annotations parsing
  • AlphaneticallySortedUsesSniff: Make error message more clear (thanks to @brettdorrans)

Fixes:

  • EarlyExitSniff: Report else when all conditions contain early exit