Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Code Sniffer Laravel Package

php-collective/code-sniffer

PHP_CodeSniffer ruleset from PhpCollective. PSR-2 compliant with many extra sniffs/fixers (incl. PSR-12) plus an optional stricter standard (PhpCollectiveStrict). Install via Composer and run phpcs/phpcbf, or wire into CI/IDE.

View on GitHub
Deep Wiki
Context7
0.5.4

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: https://github.com/php-collective/code-sniffer/compare/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 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: https://github.com/php-collective/code-sniffer/compare/0.5.2...0.5.3

0.5.2

New

Fixes

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.5.1...0.5.2

0.5.1

Fixes

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.5.0...0.5.1

0.5.0

Improvements

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: https://github.com/php-collective/code-sniffer/compare/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: https://github.com/php-collective/code-sniffer/compare/0.4.3...0.4.4

0.4.3

Improvements

  • Aded PhpCollective.ControlStructures.UnneededElse

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.4.2...0.4.3

0.4.2

Fixes

  • Fix up do while loops.
0.4.1

Fixes

  • Add missing sniff ControlStructureEmptyStatement
0.4.0

Improvements

  • Use "squizlabs/php_codesniffer": "^4.0.0" now.
0.3.1

Improvements

  • Improved PhpCollective/Sniffs/Commenting/DocBlockParamSniff to handle params better. Only require them once they are needed (missing type on a param or a random param defined already that cannot be removed).
0.3.0

What's Changed

  • Add more useful sniffs:
    • NormalizedArrays.Arrays.ArrayBraceSpacing
    • Modernize.FunctionCalls.Dirname
    • Generic.Arrays.ArrayIndent
    • Universal.Constants.LowercaseClassResolutionKeyword
    • Universal.Constants.UppercaseMagicConstants
    • Universal.Operators.ConcatPosition
    • Universal.UseStatements.NoUselessAliases
    • Universal.WhiteSpace.PrecisionAlignment
  • ArrayDeclarationSniff has now the ability to format nested arrays, use none/assoc/all (default assoc).

This package now also includes phpcsstandards/phpcsextra dependency for even better sniff experience.

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.2.21...0.3.0

0.2.21

Fixes

  • Fix false positive in DocBlockVarSniff for class aliases.
0.2.20
0.2.19

Fixes

  • Fix DocBlockVarSniff false positives
  • Don't require docblocks for fully typed methods
0.2.18

Fixes

  • Don't require docblock annotations for typed properties/variables.
0.2.17

Fixes

  • Fixed comma spacing sniff
0.2.16

Fixes

  • Fixed up compatibility with latest SlevomatCodingStandard release
0.2.15

Fixes

  • Removed more deprecation usage.
0.2.14

Fixes

  • Fixed up deprecation
0.2.13

Fixes

  • Fixed DocBlockThrow sniff
0.2.12

Improvements

Also added

  • SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing
  • SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment
  • SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses
  • Squiz.PHP.DisallowSizeFunctionsInLoops

Support for Slevomat V8.16 included.

0.2.11

Fixes

  • Fixed property replacement to FQCN for FullyQualifiedClassNameInDocBlock sniff
0.2.10

Fixes

  • Fixed DocBlockParamAllowDefaultValueSniff for PHP 8 language features
0.2.9

Fixes

  • Removed debugging statement.
0.2.8

Fixes

  • Fixed array collection to generics transformation in [@property](https://github.com/property) annotations.

Improvements

  • Added sniff PhpCollective.Commenting.DisallowShorthandNullableTypeHint to replace Nullable ? in docblocks with |null verbosely.

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.2.7...0.2.8

0.2.7

Improvements

  • Added missing SlevomatCodingStandard.Arrays.ArrayAccess sniff
0.2.6

Improvements

  • Added PSR4 namespace check for classes, traits, interfaces. It uses the composer autoload sections to compare this to the namespaces defined in each PHP class.

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.2.5...0.2.6

0.2.5

Improvements

  • Add enum case casing sniff

Full Changelog: https://github.com/php-collective/code-sniffer/compare/0.2.4...0.2.5

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport