Rorchackh
Rorchackh

Reputation: 2181

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.

Upvotes: 4

Views: 1780

Answers (2)

ericj
ericj

Reputation: 441

I am using below command to exclude pso0 rule:

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

Upvotes: 3

duellsy
duellsy

Reputation: 8577

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

Use suppression comment tags:

// @codingStandardsIgnoreStart

/* your namespacing here */

// @codingStandardsIgnoreEnd

Upvotes: 0

Related Questions