Releases: php-collective/code-sniffer
0.6.2
Improvements
- Cache class name resolution and skip redundant return-type body scans (#62)
- O(1)
conditionschecks + cached arrow-function scopes inConsistentIndentSniff(#63) - Cache
UseStatementsTrait::getUseStatementsand 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::getUseStatementsacross 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
Improvements
- Extend
DocBlockTagOrderto class, interface, and trait docblocks with a new configurableclassOrderproperty (#59) - Add opt-in inner-bucket ordering to
DocBlockTagOrdervia a newinnerOrderproperty and separateInnerOrderInvaliderror 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
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