magento-coding-standard icon indicating copy to clipboard operation
magento-coding-standard copied to clipboard

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

Open DmitryFurs opened this issue 1 year ago • 1 comments

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 _.

DmitryFurs avatar May 05 '23 14:05 DmitryFurs

Hi @DmitryFurs. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar May 05 '23 14:05 m2-assistant[bot]