You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When importing a class to be used as an attribute, PHPCS reports a SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse violation.
As it does not seem to detect the attribute usage as a valid usage.
<ruleset>
<argname="basepath"value="." />
<argname="extensions"value="php" /> <!-- which extensions to look for -->
<argname="parallel"value="80" /> <!-- how many parallel processes to run -->
<argname="colors" />
<argname="cache"value=".phpcs.cache" /> <!-- cache the results and don't commit them -->
<argvalue="np" /> <!-- n = ignore warnings, p = show progress -->
<file>assertarraysubset-autoload.php</file>
<file>src</file>
<file>tests</file>
<ruleref="DMS">
<excludename="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
</rule>
<ruleref="SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator">
<exclude-pattern>src/Constraint/ArraySubset\.php</exclude-pattern>
</rule>
<!-- BC-layer: exclude rules which would prevent code from being PHP cross-version compatible. -->
<ruleref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>assertarraysubset-autoload\.php</exclude-pattern>
<exclude-pattern>src/ArraySubsetAssertsEmpty\.php</exclude-pattern>
<exclude-pattern>src/AssertFallThrough\.php</exclude-pattern>
</rule>
<ruleref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing">
<exclude-pattern>assertarraysubset-autoload\.php</exclude-pattern>
<exclude-pattern>src/ArraySubsetAssertsEmpty\.php</exclude-pattern>
<exclude-pattern>src/AssertFallThrough\.php</exclude-pattern>
<exclude-pattern>tests/bootstrap\.php</exclude-pattern>
<exclude-pattern>tests/Availability/*\.php</exclude-pattern>
</rule>
<ruleref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName">
<exclude-pattern>assertarraysubset-autoload\.php</exclude-pattern>
<exclude-pattern>tests/Availability/*\.php</exclude-pattern>
</rule>
<ruleref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint">
<exclude-pattern>assertarraysubset-autoload\.php</exclude-pattern>
<exclude-pattern>src/AssertFallThrough\.php</exclude-pattern>
</rule>
<ruleref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<exclude-pattern>assertarraysubset-autoload\.php</exclude-pattern>
<exclude-pattern>src/AssertFallThrough\.php</exclude-pattern>
<exclude-pattern>tests/Availability/*\.php</exclude-pattern>
</rule>
</ruleset>
To reproduce
Steps to reproduce the behavior:
Create a file called test.php with the code sample above.
Run phpcs test.php ...
See error message displayed
FILE: test.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Type ReturnTypeWillChange is not used in this file.
| | (SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse)
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------
Expected behavior
No errors should be reported.
Versions (please complete the following information):
PHP: 8.0
PHPCS: 3.6.1
The text was updated successfully, but these errors were encountered:
Describe the bug
When importing a class to be used as an attribute, PHPCS reports a
SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
violation.As it does not seem to detect the attribute usage as a valid usage.
It's clearly described here by @jrfnl rdohms/phpunit-arraysubset-asserts#57
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above.phpcs test.php ...
Expected behavior
No errors should be reported.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: