Skip to content

[Bug] Magento2.Exceptions.Namespace causes false-positive findings #67

Closed
@lenaorobei

Description

@lenaorobei

Preconditions

Magento2 CodingStandard is installed.

Steps to reproduce

Run against Magento2 codebase.
vendor/bin/phpcs --standard=Magento2 app/code lib/internal/ --sniffs=Magento2.Exceptions.Namespace -s

Expected result

No false-positive findings.

Actual result

>60 false-positive findings detected. Example:

FILE: app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/ColumnResolver.php
--------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------
 60 | WARNING | Namespace for ColumnNotFoundException class is not specified. (Magento2.Exceptions.Namespace.NotFoundNamespace)
 65 | WARNING | Namespace for ColumnNotFoundException class is not specified. (Magento2.Exceptions.Namespace.NotFoundNamespace)
--------------------------------------------------------------------------------------------------------------------------------------------------

Solution

Remove this rule from Coding Standard in favor of implementation that can capture class existence (PHPStan).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfalse positiveRule causes false positive findings

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions