Skip to content

Magento2\Sniffs\Legacy\RestrictedCodeSniff doesn't catch namespaced classes #444

Open
@DmitryFurs

Description

@DmitryFurs

Preconditions

  1. Magento 2.4.5-p1
  2. Magento Coding Standard v29

Steps to reproduce

  1. Create a php file, where you include any namespaced class from restricted_classes.php for example \Magento\Framework\Serialize\Serializer\Serialize in the constructor or any other place
  2. Run code sniffer on that file.

Expected result

  1. Sniffer caught the class

Actual result

  1. Sniffer didn't catch the class

Notes

Registered tokens contain only partial values for classes, they transmit parts of this class in turn, Magento, then Framework, then Serialize, and so on, but the whole class is not transmitted. Therefore, the sniffer only works for classes that consist of a single word or are combined with an underscore _.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions