How can I get PHP CodeSniffer Fixer to ignore a namespace declaration?

I am using sublime text 2 plugin for PHP Fixer Fixer . It works fine, except for the fact that it considers the namespace invalid (this is actually invalid, and I'm fine with it). these errors stop the script from fixing the rest of the file. I get the following error:

! The namespace Application\Controllers\Admin in <filepath> does not match the file path according to PSR-0 rules. 

How can I tell the script to ignore the namespace restriction. Both command line parameters and Sublime text 2 user settings can be changed.

+4
source share
2 answers

I use the command below to exclude the pso0 rule:

 php-cs-fixer fix --level="psr2" PATH --fixers=-psr0 
+3
source

While the ugly, short solution might be to add something like the following:

Use suppression comment tags:

 // @codingStandardsIgnoreStart /* your namespacing here */ // @codingStandardsIgnoreEnd 
0
source

Source: https://habr.com/ru/post/1440252/


All Articles