Skip to content

Releases: php-collective/code-sniffer

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

0.5.0

27 Nov 22:44

Choose a tag to compare

Improvements

  • Add support for multi-line array shape annotations by @dereuromark in #38
  • Fix VariableWrong false positives for partial doc blocks by @dereuromark in #40
  • Fix scope_opener error for abstract/interface methods by @dereuromark in #39
  • Skip docblock requirement for constructors with fully typed parameters by @dereuromark in #41
  • Fix param order when adding missing @param annotations by @dereuromark in #42
  • Remove AttributesSniff to fix conflict with Slevomat ReferenceUsedNamesOnly by @dereuromark in #43

The attribute usage is now the same as class usage. This seems to make sense moving forward and to not clash with other sniffer packages - and triggers now the major.

Full Changelog: 0.4.6...0.5.0

0.4.6

27 Oct 14:04

Choose a tag to compare

Fixes

  • Fixed use statement sniff regressions

Improvements

  • Added ConsistentIndentSniff

0.4.5

23 Oct 03:16

Choose a tag to compare

Improvements

  • Added auto fixing to FQCN attribute sniff.

0.4.4

22 Oct 13:56

Choose a tag to compare

Improvements

  • Added PhpCollective.ControlStructures.ControlSignature sniff

Full Changelog: 0.4.3...0.4.4