Skip to content

Releases: php-collective/code-sniffer

0.6.4

08 Jun 23:27
78498f0

Choose a tag to compare

Fixes

  • DocBlockVar fixer no longer corrupts callable/Closure property types when appending a missing null. The first-space split used to cut a \Closure(string): string signature in half, producing an unparseable @var annotation. Types with internal structure (callable/Closure signatures, generics, array shapes) are now left untouched, while simple types with a trailing parenthetical description still get their missing null appended.

Full Changelog: 0.6.3...0.6.4

0.6.3

28 May 15:58
bfff5aa

Choose a tag to compare

Fixes

  • Proper native union type order - also consistent with docblocks - #67
  • Fix phpcbf conflict on anonymous class bodies in ConsistentIndent - #68

Full Changelog: 0.6.2...0.6.3

0.6.2

13 May 22:01
c9b7e70

Choose a tag to compare

Improvements

  • Cache class name resolution and skip redundant return-type body scans (#62)
  • O(1) conditions checks + cached arrow-function scopes in ConsistentIndentSniff (#63)
  • Cache UseStatementsTrait::getUseStatements and bound the throw class-name lookup to the current statement (#64)
  • Cache docblock FQCN lookups (parseUseStatements / getNamespace) and dedupe per-doc-block processing (#65)
  • Cache UseStatementSniff::getUseStatements across phpcbf fix iterations (#66)

Combined, these cut composer cs-check wall-clock time roughly in half on large method-heavy codebases. On an 11k-line CakePHP controller the slowest single file went from ~40s to ~6s; on a 1095-file project the whole-codebase scan dropped from ~2m08s to ~30s with parallel=16.

Full Changelog: 0.6.1...0.6.2

0.6.1

12 May 08:34
b21e5e9

Choose a tag to compare

Improvements

  • Extend DocBlockTagOrder to class, interface, and trait docblocks with a new configurable classOrder property (#59)
  • Add opt-in inner-bucket ordering to DocBlockTagOrder via a new innerOrder property and separate InnerOrderInvalid error code, so inner ordering can be enabled and scoped independently of bucket ordering (#60)

Full Changelog: 0.6.0...0.6.1

0.6.0

14 Apr 13:34

Choose a tag to compare

Fixes

  • Fix DocBlockParamAllowDefaultValueSniff positional mismatch on partial @param lists, which could cause an infinite fixer loop with DocBlockParamTypeMismatchSniff (#58)

Improvements

  • Replace internal sniffs with their PHPCSExtra Universal equivalents (supersets): PhpCollective.ControlStructures.DisallowAlternativeControlStructuresUniversal.ControlStructures.DisallowAlternativeSyntax, PhpCollective.WhiteSpace.CommaSpacingUniversal.WhiteSpace.CommaSpacing (#55)
  • Add additional Universal sniffs to the ruleset (#54)
  • Add Universal attribute and whitespace sniffs (#56)
  • Disallow partial uses in ReferenceUsedNamesOnly (#57)

Migration

Partial namespace references (e.g. Mockery\MockInterface when only Mockery is imported) are now flagged and must be imported via a full use statement. To keep the previous behavior, override the property in your project's phpcs.xml:

<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
    <properties>
        <property name="allowPartialUses" value="true"/>
    </properties>
</rule>

Full Changelog: 0.5.5...0.6.0

0.5.5

10 Apr 14:53
024d26f

Choose a tag to compare

Fixes

  • Fix docblock indentation loss when EmptyEnclosingLine sniff interacted with DisallowTabIndent (#52)
  • Fix InlineDocBlockSniff for abstract/interface methods - skip methods without body (#51)
  • Fix NoIsNullSniff calling wrong method for trailing comparisons (#49)
  • Fix EnumCaseCasingSniff multibyte support with proper mb_strtoupper() (#49)

Full Changelog: 0.5.4...0.5.5

0.5.4

27 Mar 06:48

Choose a tag to compare

Features

  • DocBlockReturnVoidSniff: Add optional checkReturnTypeHint property to detect invalid : void return type hints on magic methods (__construct, __destruct, __clone)

Fixes

  • DocBlockReturnVoidSniff: Fix hasReturnType() to properly detect return type declarations on interface and abstract methods. Previously, methods with return types but no body (e.g., public function foo(): string;) incorrectly triggered ReturnMissingInInterface errors.

Full Changelog: 0.5.3...0.5.4

0.5.3

11 Feb 16:40

Choose a tag to compare

Improvements

UseStatementSniff Enhancements

  • PHP 8+ Attribute Support: FQCNs in attributes are now detected and auto-fixed

    // Before
    #[\Foo\Bar\SomeAttribute]
    class MyClass {}
    
    // After
    use Foo\Bar\SomeAttribute;
    
    #[SomeAttribute]
    class MyClass {}
  • PHP 8.1+ Enum Support: Enum implements clauses are now handled

    // Before
    enum Status: string implements \Foo\Bar\SomeInterface {}
    
    // After
    use Foo\Bar\SomeInterface;
    
    enum Status: string implements SomeInterface {}

Notes

Only fully qualified names (starting with \) are auto-fixed. Partially qualified names (e.g., Foo\Bar without leading \) are intentionally not auto-fixed right now.

Full Changelog: 0.5.2...0.5.3

0.5.2

01 Feb 12:44

Choose a tag to compare

New

  • Add PipeOperatorSpacingSniff for PHP 8.5 pipe operator - #37
  • Add VoidCastSniff for PHP 8.5 void cast support - #36

Fixes

  • Fix containsTypeArray to recognize array shape syntax (array{...}) - #45

Full Changelog: 0.5.1...0.5.2

0.5.1

03 Dec 15:53
a509ed7

Choose a tag to compare

Fixes

  • Preserve parameter order when inserting missing @param annotations - #44

Full Changelog: 0.5.0...0.5.1