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

spryker/code-sniffer

Spryker Code Sniffer is a PHP_CodeSniffer ruleset for Spryker projects. Enforces Spryker coding standards and best practices, supports automated code style checks in CI, and helps keep code consistent across teams and modules.

View on GitHub
Deep Wiki
Context7
0.17.34

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.33...0.17.34

Improvements

  • Fixed CommentingTrait::hasInheritDoc() so now it recognizes the inline {[@inheritDoc](https://github.com/inheritDoc)} form as doc-block inheritance.
0.17.33

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.32...0.17.33

Improvements

  • Fixed CommentingTrait::hasInheritDoc() so now it recognizes the inline {[@inheritDoc](https://github.com/inheritDoc)} form as doc-block inheritance.
0.17.31

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.30...0.17.31

Improvements

  • Added phpstan/phpstan new ^2.* module version support.
0.17.30

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.29...0.17.30

Improvements

  • Added PHP 8.4 support.

Checklist

  • I agree with the Code Contribution License Agreement in CONTRIBUTING.md
0.17.29

Fixes

New Contributors

Full Changelog: https://github.com/spryker/code-sniffer/compare/0.17.28...0.17.29

0.17.28

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.27...0.17.28

Fixes

  • Temporary locked the usage version for phpstan/phpdoc-parser used in the tool.
0.17.27

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.26...0.17.27

Improvements

  • Enabled the usage of null safe object operators.
0.17.26

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.25...0.17.26

Improvements

  • Added SprykerFeature module types to supported namespaces.
0.17.25

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.24...0.17.25

Improvements

  • Added PHP 8.3 support.
0.17.24

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.23...0.17.24

Fixes

  • Adjusted DocBlockApiAnnotationSniff to fix the false negative errors when declaring the Specification annotation.
0.17.23

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.22...0.17.23

Fixes

  • Adjusted QueryContainerMethodAnnotationSniff to remove deprecated getQueryContainer() annotation validation.
0.17.22

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.21...0.17.22

Fixes

  • Adjusted configuration so it supports Constructor Property Promotion.
0.17.21

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.20...0.17.21

Fixes

  • Adjusted rules Spryker/ruleset.xml to fix false negative error.
0.17.20

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.19...0.17.20

Fixes

  • Adjusted SprykerStrict/ruleset.xml to fix ERROR: Ruleset invalid. Property "enableNeverTypeHint" does not exist on sniff SprykerStrict.TypeHints.ParameterTypeHint error.
0.17.19

Included commits: https://github.com/spryker/code-sniffer/compare/0.17.18...0.17.19

Improvements

  • Added PHP 8.2 support.
  • Allow Spryker.Namespaces.SprykerNamespace to be used in a more generic context.
  • Any custom repository using PSR-4 namespacing can now also be used with this to check the namespace vs file name.
    <rule ref="Spryker.Namespaces.SprykerNamespace">
        <properties>
            <property name="namespace" value="App"/>
            <property name="isRoot" value="true"/>
        </properties>
    </rule>

It would then validate your class files within src/:

  • file name src/Some/Sub/MyClass.php would then have to match FQCN App\\Some\\Sub\\MyClass inside

Note: If not further specific, it will still only check Spryker core files here for now and skip all other class files.

0.17.18

Fixes

Fix up DocBlockParamAllowDefaultValueSniff to not error on nullable annotation for mixed type.

0.17.17

Fixes

The previous fix didn't fix all issues around the PHP anti-pattern of mixed type including null. Now DocBlockReturnNullableTypeSniff does not prematurely add null for a mixed return type annotation, as well.

0.17.16

Fixes

DocBlockReturnNullableTypeSniff does not falsely remove null for a mixed return type annotation.

0.17.15

Fixes

  • Fixed up 7.4+ safety rules. They can always be muted for PHP 8.0+ repositories. E.g. for a PHP 8.0 project, set this to allow ?-> and have improved diff output for changes now:
    <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
    <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse"/>

    <rule ref="SlevomatCodingStandard.ControlStructures.DisallowNullSafeObjectOperator">
        <severity>0</severity>
    </rule>
    <rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration">
        <severity>0</severity>
    </rule>
    <rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInClosureUse">
        <severity>0</severity>
    </rule>
0.17.14

Fixes

Fixed false positive on usage of list<\Type>

Improvements

Now PHP 7.4+ and tested on PHP 8.2.

0.17.13

Fixes

Fixed sniffs around param type parsing and errors with new PHPStan versions.

0.17.12

Fixes

The else if to elseif sniff and fixer so far was always just a warning, which usually didn't show the issue. This has been fixed with a Spryker sniff that now enforces this on an error level. It will auto-fix itself for code that doesn't yet follow the coding guidelines.

Improvements

Projects as well as libraries can now enable strict_types for PHP files.

    <rule ref="Spryker.PHP.DeclareStrictTypesAfterFileDoc">
        <properties>
            <property name="strictTypesMandatory" value="true"/>
        </properties>
    </rule>

Please note: This can have side effects as type casting is now not happening anymore in some cases.

Also: declare(strict_types=1); is now consistently placed within a PHP file, after the file doc block as per PSR-12 specification.

0.17.11

Fixes

  • Allow class-string to pass as string type in docblocks, including class-string<\Some\Class\Name>.

Improvements

  • Added SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse sniff
0.17.10

Fixes

Fixed DocBlockVar sniff to handle and allow list<type> documentation for array collections.

0.17.9

Fixes

Adjusted the SprykerStrict sniffers as per our minimum PHP version to ensure that no accidents happen in regards to signature changes that are not PHP version compatible.

0.17.8

Improvements

Allow for new slevomat/coding-standard 8.x. This is to allow for all new fixes of that series to be used by everyone.

Please note You need to add the php_version config in your root phpcs.xml file before upgrading.

E.g. if you are using >= 7.4 in composer as PHP min requirement:

<config name="php_version" value="70400"/>

The reason is that it would otherwise execute your local PHP version (e.g. 8.1) and modify the code according to "too new language features".

What's Changed

New Contributors

Full Changelog: https://github.com/spryker/code-sniffer/compare/0.17.7...0.17.8

0.17.7

Fixes

  • Fixed fatal error for class exists checks
  • Fixed newline issue for file docblock
  • Fixed FQCN to use statements for properties
0.17.6

Fixes

  • Fixed missing newline separation for class constants.
  • Fixed method annotation sniff when using final classes - thanks to @alfredbez.

Improvements

  • Full generics support for all object collections.
  • Improved method annotation sniff - thanks to @alfredbez

For generics please make sure:

  • To have updated all non-generic docblocks first. \SomeObject|some-type[] that is actually a true "object or array" case must be noted as \SomeObject|array<some-type>. If you do not do this before this update, it will change it as per expectation regarding legacy syntax.
  • You update your PHPStan files to either include checkGenericClassInNonGenericObjectType: false or to adjust your docblocks to specify the type of generic class/object.

For project annotations:

0.17.5

Fixes

  • Fix throw annotation sniff regarding static calls.
  • Fix UseStatement sniff to not false positive on method attributes at start of the class or interface.
  • Add Countable into sorting of TypeHintSniff.
0.17.4

Fixes

  • Fixed DocBlockThrows sniff to make sure FQCN adds no extra leading backslash.
  • Fixed DocBlockReturnTag sniff for more complex generics.

Improvements

Added Spryker.PHP.DisallowTrailingCommaInSingleLine to avoid side effects with other sniffs.

Added Spryker.ControlStructures.DisallowCloakingCheck to remove unnecessary anti-pattern of cloaking (silencing of non-existence), regarding variables and properties. This is also in sync with stricter 8.2+ in the future, but already now can spot a few typos and no-ops.

Make sure to always declare local variables or class properties before using. Using isset()/empty() is only useful when the key of an array is possibly undefined. This is never the case on local variables or normal class properties. It has a strict mode (default off) which would also disallow some edge cases and silencing for dynamic property access.

We don't want to go quite as far as this article and say never, but there are some use cases where more appropriate solutions are possible:

$x = !empty($this->property) !== false;
// should be
$x = (bool)$this->property;
 
if (isset($this->property)) {}
// should be
if ($this->property !== null) {}
 
if (empty($myTransfer->getFoo()) {}
// should be
if (!$myTransfer->getFoo()) {}

For further reference see guidelines.

0.17.3

Fixes

Fixed InlineDocBlock sniff to handle annotations with a comments above.

0.17.2

Fixes

  • Removed silencing of method signature whitespace issues, especially around multiline signatures. They can be auto-fixed now.
  • Fixed [@throws](https://github.com/throws) annotation fixing using full FQCN string.
0.17.32
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky