Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlevomatCodingStandard.Namespaces.UnusedUses mistakenly reports E_ALL #1038

Closed
morozov opened this issue Jun 17, 2020 · 2 comments · Fixed by doctrine/dbal#4120
Closed

SlevomatCodingStandard.Namespaces.UnusedUses mistakenly reports E_ALL #1038

morozov opened this issue Jun 17, 2020 · 2 comments · Fixed by doctrine/dbal#4120
Labels

Comments

@morozov
Copy link

morozov commented Jun 17, 2020

$ composer show | grep -P 'coding-standard|php_codesniffer'

doctrine/coding-standard                       8.0.0   The Doctrine Coding Standard is a ...
slevomat/coding-standard                       6.3.8   Slevomat Coding Standard for PHP_C...
squizlabs/php_codesniffer                      3.5.5   PHP_CodeSniffer tokenizes PHP, Jav...

Consider the following code example:

<?php

namespace Foo;

use const E_ALL;
use const E_NOTICE;

echo E_ALL & ~E_NOTICE;

The following violation is reported:

FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
 5 | ERROR | [x] Type E_ALL is not used in this file.
   |       |     (SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse)
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------

After a fix, the file will look like this:

<?php

namespace Foo;

use const E_NOTICE;

echo E_ALL & ~E_NOTICE;
@kukulich
Copy link
Contributor

Thank you for your report.

Fixed in c4e2878

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants