NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #4110 most downloaded on Packagist
Spryker Code Sniffer Standards
Latest stable
0.17.36
Last release 3 months ago
21 Aug 2026
Ships fairly regularly
a new release about every 3 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
120 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.35...0.17.36
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.35...0.17.36
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.34...0.17.35
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.34...0.17.35
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.33...0.17.34
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.33...0.17.34
CommentingTrait::hasInheritDoc() so now it recognizes the inline {@inheritDoc} form as doc-block inheritance.Your coding agent can read these notes before it upgrades. Set up the MCP server →
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.32...0.17.33
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.32...0.17.33
CommentingTrait::hasInheritDoc() so now it recognizes the inline {@inheritDoc} form as doc-block inheritance.Included commits: https://github.com/spryker/code-sniffer/compare/0.17.31...0.17.32
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.31...0.17.32
@param may now be omitted when the native type hint already expresses the full type. The previous strict 1:1 count between @param tags and parameters is no longer required — fully type-hinted scalar/object params can drop their docblock.?? '' null-coalesce on a regex capture group that PHPStan L8 flagged as always-present; the error message now uses rtrim($comment), which is equivalent and robust across PHPStan versions.empty() edge case.Included commits: https://github.com/spryker/code-sniffer/compare/0.17.30...0.17.31
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.30...0.17.31
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.29...0.17.30
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.29...0.17.30
PHP 8.4 support.Fixed usage of deprecated Sniffer rules. by @stereomon in https://github.com/spryker/code-sniffer/pull/383
Full Changelog: https://github.com/spryker/code-sniffer/compare/0.17.28...0.17.29
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.27...0.17.28
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.27...0.17.28
phpstan/phpdoc-parser used in the tool.Included commits: https://github.com/spryker/code-sniffer/compare/0.17.26...0.17.27
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.26...0.17.27
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.25...0.17.26
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.25...0.17.26
SprykerFeature module types to supported namespaces.Included commits: https://github.com/spryker/code-sniffer/compare/0.17.24...0.17.25
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.24...0.17.25
8.3 support.Included commits: https://github.com/spryker/code-sniffer/compare/0.17.23...0.17.24
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.23...0.17.24
DocBlockApiAnnotationSniff to fix the false negative errors when declaring the Specification annotation.Adjusted QueryContainerMethodAnnotationSniff to remove deprecated getQueryContainer() annotation validation.
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.22...0.17.23
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.21...0.17.22
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.21...0.17.22
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.20...0.17.21
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.20...0.17.21
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.19...0.17.20
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.19...0.17.20
SprykerStrict/ruleset.xml to fix ERROR: Ruleset invalid. Property "enableNeverTypeHint" does not exist on sniff SprykerStrict.TypeHints.ParameterTypeHint error.Included commits: https://github.com/spryker/code-sniffer/compare/0.17.18...0.17.19
Included commits: https://github.com/spryker/code-sniffer/compare/0.17.18...0.17.19
Spryker.Namespaces.SprykerNamespace to be used in a more generic context. <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/:
src/Some/Sub/MyClass.php would then have to match FQCN App\\Some\\Sub\\MyClass insideNote: If not further specific, it will still only check Spryker core files here for now and skip all other class files.
Fix up DocBlockParamAllowDefaultValueSniff to not error on nullable annotation for mixed type.
Fix up DocBlockParamAllowDefaultValueSniff to not error on nullable annotation for mixed type.
The previous fix didn't fix all issues around the PHP anti-pattern of mixed type including null. Now DocBlockReturnNullableTypeSniff does not prematur
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.
DocBlockReturnNullableTypeSniff does not falsely remove null for a mixed return type annotation.
DocBlockReturnNullableTypeSniff does not falsely remove null for a mixed return type annotation.
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 di
?-> 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>
Fixed false positive on usage of list<\Type>
Fixed false positive on usage of list<\Type>
Now PHP 7.4+ and tested on PHP 8.2.
Fixed sniffs around param type parsing and errors with new PHPStan versions.
Fixed sniffs around param type parsing and errors with new PHPStan versions.
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
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.
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.
Allow class-string to pass as string type in docblocks, including class-string<\Some\Class\Name>.
class-string to pass as string type in docblocks, including class-string<\Some\Class\Name>.SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse sniffFixed DocBlockVar sniff to handle and allow list documentation for array collections.
Fixed DocBlockVar sniff to handle and allow list<type> documentation for array collections.
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
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.
Allow for new slevomat/coding-standard 8.x. This is to allow for all new fixes of that series to be used by everyone.
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".
slevomat/coding-standard:^8.0.1 by @localheinz in https://github.com/spryker/code-sniffer/pull/345Full Changelog: https://github.com/spryker/code-sniffer/compare/0.17.7...0.17.8
Fixed fatal error for class exists checks
Fixed missing newline separation for class constants.
For generics please make sure:
\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.checkGenericClassInNonGenericObjectType: false or to adjust your docblocks to specify the type of generic class/object.For project annotations:
Pyz namespace, you need to add a few configs to let the sniffer know about this and make the correct class usage assessment: https://github.com/spryker/code-sniffer#configure-custom-namespacesFix throw annotation sniff regarding static calls.
Fixed DocBlockThrows sniff to make sure FQCN adds no extra leading backslash.
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.
Fixed InlineDocBlock sniff to handle annotations with a comments above.
Fixed InlineDocBlock sniff to handle annotations with a comments above.
Removed silencing of method signature whitespace issues, especially around multiline signatures. They can be auto-fixed now.
@throws annotation fixing using full FQCN string.Removed irrelevant Spryker.Commenting.DocBlockVariableNullHintLast sniff which also gave false-positive results
@return \Iterator|\Generated\Shared\Transfer\EventEntityTransfer[][])The old string[] syntax is deprecated and replaced by generics, as it can now also focus on key instead of just value:
The old string[] syntax is deprecated and replaced by generics, as it can now also focus on key instead of just value:
array<string> (list) vs array<string, string> (associative array)\MyCollection|\MyObject[] as legacy typehint in place. Custom @phpstan-* tags on top can be "clean" already.The current ruleset auto-fixes this as follows:
string[][][] etc to array<array<array<string>>> as deep as necessary for all simple generics\ArrayObject|type[] to \ArrayObject<type> (simple) generic objects understood by IDEs like PHPStorm\Complex\Collection|type[] collection object - the only way to be understood by PHPStorm and still understood by PHPStan/Psalm\Complex\Collection<type> as this is not yet understood by IDEs like PHPStorm\Complex\Collection|array<type> as this is invalid as per PHPStan/Psalm\Redirect|array<keytype, valuetype> as long as the key is defined here as well, as this does not then count as generic collection object (iterating over values), but as two completely different types.All files should be annotated using generics pattern to clarify iterable value type, and in case it cannot be clarified more would just be type<mixed>.
Where possible (speficially associative array), also always define (string) key type.
In some cases, extra PHPStan annotations on top might be necessary. But in most cases, those are not and should not be added.
Whenever you work with generic collection objects, it is advised to specify the "fully correct" syntax in phpstan-* tags on top. If known/possible, you can even specify the key here.
* @phpstan-param \My\Collection<string, \Some\Ţransfer>
* @param \My\Collection|\Some\Ţransfer[]
It is recommended now to remove the following part from your phpstan.neon files:
checkMissingIterableValueType: false
And if defined correctly, also this can be removed:
checkGenericClassInNonGenericObjectType: false
With PHP 7.3 being already EOL soon, it only makes sense to drop the already very long EOL 7.2 version. It is already PHP 8.1 tested, however, as well.
Quite a few more sniffs to make sure the code is also semantically checked even before any static analyzer like PHPStan/Psalm look at it. Specifically interesting:
Also:
It does by default disallow some newer PHP 8 language elements for the project to be 7.4+. If you are running already PHP 8, you can exclude those using
<rule ref="vendor/spryker/code-sniffer/Spryker/ruleset.xml">
<exclude name="SlevomatCodingStandard.Functions.DisallowNamedArguments"/>
<exclude name="SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowNullSafeObjectOperator"/>
...
</rule>
Removed issues around PHP8 attributes.
SlevomatCodingStandard.Whitespaces.DuplicateSpaces sniff.Spryker.Internal.SprykerDisallowFunctions sniff which is only enabled for core level by default.If you want to enable Spryker.Internal.SprykerDisallowFunctions for your project level, set this into your phpcs.xml file:
<rule ref="Spryker.Internal.SprykerDisallowFunctions">
<properties>
<property name="phpVersion" value="7.4"/>
</properties>
</rule>
Set the current PHP version you are using which will disallow methods of the next minors and majors.
If you already require certain polyfills, you can raise this version or completely disable it (even the core check) by using 'off' value.
Skip @var docblocks for inheritDoc case.
@var docblocks for inheritDoc case./** ... */, /* ... */ and // ... are comments (multi/single line). Using them wrongly makes tools like PHPStan/Psalm to ignore or misinterpret them.@throws \Exception ! would not get removed. Handle with care, as manual exceptions declared can often go out of sync with the actual code implementation, especially if nested multiple levels.With this release we prepare for the next major which will enforce iterable generics (<>) that succeed the deprecated [] syntax.
All changes here are BC under correct standards and/or auto-fixable to allow a smooth upgrade. It is recommended to run this first over a freshly branched master and fast-track this into master. Then all other branches can have master merged. This way the changes will have minimal impact. You can also always silence certain sniffs until the upgrade is ready.
Turns out PHPStan assumes a "mixed" kind of result for constants that are extended/extendable.
In this case, even if a constant is e.g. only declared and used as string, it kills all static analyzing in usage.
Adding docblocks to all class constants with the @var type defined makes it possible to detect issues here in code early on.
This release ships with reporting for all constants that are trivial and can be easily auto-fixed. It currently skips the non-trivial ones.
Those non-trivial ones (e.g. using another const) are not relevant, though, as the inheritance has those also already typed as defined.
With this release we prepare for the next major which will enforce iterable generics (<>) that succeed the deprecated [] syntax.
array<string, string> instead of string[] to also express that the key is an associative key of the array.(int|string)[] now is array<int|string>string[][] is now array<array<string>> where possibly also the keys might be useful/recommended to document with the corresponding type - especially if associative.\ArrayObject|\Generated\Shared\Transfer\PriceProductTransfer[] can be better documented as \ArrayObject<int, \Generated\Shared\Transfer\PriceProductTransfer>Anything more complex can always go into the phpstan-* tags as before, same for shapes {}.
EmptyEnclosingLine sniff has now reduced side effects (if used standalone)
Fixed Linelength sniffer to properly fix found issues.
Support for Service layer in regards to @api definition
@api definitionAdded Spryker.Testing.ExpectException
Upgrade efforts coming from 0.15 should be zero here if no sniffs are extended on project level.
final declaration requires public or protected visibility for PHP 8+
final declaration requires public or protected visibility for PHP 8+
final declaration requires public visibility for PHP 8+
final declaration requires public visibility for PHP 8+is_resource can be used again, PHP 8 does not have issues with the way it is normally usedPlease note: This library is now PHP 7.2+
Added SlevomatCodingStandard.Classes.ClassMemberSpacing
Fixed exit() vs die() sniff and assert that they are not used (left over) by accident in code. They always must have an argument - as integer exit cod
Fixed exit() vs die() sniff and assert that they are not used (left over) by accident in code.
They always must have an argument - as integer exit code.
This prevents CI or deploy reports from being false green due to accidentally left over dump(...); exit() exiting with code 0 (OK).
Added DisallowFunctionsSniff to allow is_resource() from being excluded from own code (as this method is not PHP 8 compatible).
Fixed DocBlockThrowsSniff for throw using method calls
Removed false-positive errors in FullyQualifiedClassNameInDocBlockSniff
Allow basic array or interable usage now in doc blocks. We do not encourage it at this point, as IDEs still don't understand them inside @param and @r
Allow basic array<x, y> or interable<x, y> usage now in doc blocks. We do not encourage it at this point, as IDEs still don't understand them inside @param and @return, but it is possible to do so now on project level.
Tip: Instead, use @phpstan-* or @psalm-* annotations on top of the current ones where needed. This works then for both developer usability (IDEs) and static analysis.
For a Generator it could look like the following:
/**
* @phpstan-return \Generator<\My\ClassName>
*
* @return \Generator|\My\ClassName[]
*/
public function someCollection(): Generator
{
yield ...;
}
FQCN class strings can be annotated this way:
/**
* @phpstan-return class-string<\Foo>[]
*
* @return string[]
*/
public function someClassNames(): array
{
return [
'Foo' => Foo::class,
];
}
Also the type of the key where applicable:
/**
* @phpstan-return array<string, \Foo>
*
* @return \Foo[]
*/
public function someClassNames(): array
{
return [
'Foo' => new Foo(),
];
}
Hard limit for line length has now been adjusted from 200 to 160
Consider the following fix this sniff did for us:
- $this->fillField("//*[@id=\"cms_page_validFrom\"]", $date);
+ $this->fillField('//*[@id="cms_page_validFrom"]', $date);
Added Generic.PHP.DeprecatedFunctions sniff to find and alert about deprecated PHP functions used.
Generic.PHP.DeprecatedFunctions sniff to find and alert about deprecated PHP functions used.Switched to new PSR12 standard/ruleset where possible and silence contradicting and deprecated PSR2 rules.
return one.slevomat/coding-standard v6 dependency upgrade.The Spryker code sniffer package now ships with 190+ sniffs :tada:
Better void vs non-void detection in lying docblock return types.
Allow empty .license file to have no license doc block in the repository class files.
.license file to have no license doc block in the repository class files.### Improvements Added new PSR12 sniffer rules. ### Bugfixes Fixed SprykerNamespaceSniff.
Added new PSR12 sniffer rules.
Fixed SprykerNamespaceSniff.
Fixed dependency towards PHPCS release 3.5.0+
yield usageCompatibility with new PHPCS release 3.5.0 - silenced buggy sniffs for now since they are covered by Spryker ones anyway
Doc blocks are now more correctly checked. Whitespace around tags included.
Spryker now allows using union type arrays for param/return annotations.
string[]|int[] means something slightly different than (string|int)[]. The latter is now also supported and encouraged to be used when the stacks are not completely of one type but of possibly multiple types.
This syntax still focuses on the value of the array, not the key.
Spryker now normalizes inheritdoc to inheritDoc, both for partial ({@inheritDoc}) and full (@inheritDoc) overwrite.
The partial is only allowed for textual overwrite and has to re-define all other tags. The full overwrite includes all tags. {inheritDoc} is auto-fixed to proper {@inheritDoc}.
Fixed MethodSpacing sniff for PHP 7 return types
One column per quarter.