简体   繁体   中英

How can I make PHP CodeSniffer Fixer ignore the namespace declaration?

I am using the sublime text 2 plugin for PHP Coding Standards Fixer . It is working fine, except for the fact that it considers the namespace invalid (it is in fact invalid and I'm okay with it). this errors halts the script from correcting 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 the script to ignore the namespace constraint. Both command line arguments and Sublime text 2 user settings can be changed.

我使用下面的命令来排除pso0规则:

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

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

Use suppression comment tags:

// @codingStandardsIgnoreStart

/* your namespacing here */

// @codingStandardsIgnoreEnd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM