Skip to content

4.7.0

Compare
Choose a tag to compare
@kukulich kukulich released this 24 Aug 23:08
· 1497 commits to master since this release
4.7.0
51be382

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