Releases: php-collective/code-sniffer
0.6.0
Fixes
- Fix DocBlockParamAllowDefaultValueSniff positional mismatch on partial
@paramlists, which could cause an infinite fixer loop with DocBlockParamTypeMismatchSniff (#58)
Improvements
- Replace internal sniffs with their PHPCSExtra Universal equivalents (supersets):
PhpCollective.ControlStructures.DisallowAlternativeControlStructures→Universal.ControlStructures.DisallowAlternativeSyntax,PhpCollective.WhiteSpace.CommaSpacing→Universal.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
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
Features
- DocBlockReturnVoidSniff: Add optional
checkReturnTypeHintproperty to detect invalid: voidreturn 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 triggeredReturnMissingInInterfaceerrors.
Full Changelog: 0.5.3...0.5.4
0.5.3
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
implementsclauses 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
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
Fixes
- Preserve parameter order when inserting missing
@paramannotations - #44
Full Changelog: 0.5.0...0.5.1
0.5.0
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
@paramannotations 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
Fixes
- Fixed use statement sniff regressions
Improvements
- Added ConsistentIndentSniff
0.4.5
Improvements
- Added auto fixing to FQCN attribute sniff.
0.4.4
Improvements
- Added PhpCollective.ControlStructures.ControlSignature sniff
Full Changelog: 0.4.3...0.4.4