magento-coding-standard
magento-coding-standard copied to clipboard
Magento2\Sniffs\Legacy\RestrictedCodeSniff doesn't catch namespaced classes
Preconditions
- Magento 2.4.5-p1
- Magento Coding Standard v29
Steps to reproduce
- 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
- Run code sniffer on that file.
Expected result
- Sniffer caught the class
Actual result
- 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 _
.
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.