reneoelke / Php53to54

PHP_CodeSniffer standard for compatibility checking of PHP 5.3 to 5.4 migrations.
http://foobugs.com
Other
6 stars 1 forks source link

Usage as external Standard #49

Closed Ephigenia closed 12 years ago

Ephigenia commented 12 years ago

There are problems using PHP53to54 as standalone standard when it comes to class loading and using the ruleset.xml with configuration. PHPCS does not seem to find the right class for `"ref="PHP53to54.Generic.ForbiddenClassNames"

If i run:

phpcs -p -v --standard=/Users/ephigenia/Sites/jagger/PHP53to54 ./

I get an error like this:

Registering sniffs in PHP53to54 standard... PHP Fatal error:  Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist' in /usr/lib/php/pear/PHP/CodeSniffer.php:814
Stack trace:
#0 /usr/lib/php/pear/PHP/CodeSniffer.php(730): PHP_CodeSniffer->_expandRulesetReference(Object(SimpleXMLElement))
#1 /usr/lib/php/pear/PHP/CodeSniffer.php(623): PHP_CodeSniffer->getSniffFiles('/Users/ephigeni...', 'PHP53to54')
#2 /usr/lib/php/pear/PHP/CodeSniffer.php(438): PHP_CodeSniffer->setTokenListeners('/Users/ephigeni...', Array)
#3 /usr/lib/php/pear/PHP/CodeSniffer/CLI.php(551): PHP_CodeSniffer->process(Array, '/Users/ephigeni...', Array, false)
#4 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process()
#5 {main}
  thrown in /usr/lib/php/pear/PHP/CodeSniffer.php on line 814

Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist' in /usr/lib/php/pear/PHP/CodeSniffer.php on line 814

PHP_CodeSniffer_Exception: Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist in /usr/lib/php/pear/PHP/CodeSniffer.php on line 814

Call Stack:
    0.0002     653752   1. {main}() /usr/bin/phpcs:0
    0.0089    2414608   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:37
    0.0096    2425704   3. PHP_CodeSniffer->process() /usr/lib/php/pear/PHP/CodeSniffer/CLI.php:551
    0.0097    2428240   4. PHP_CodeSniffer->setTokenListeners() /usr/lib/php/pear/PHP/CodeSniffer.php:438
    0.0097    2428384   5. PHP_CodeSniffer->getSniffFiles() /usr/lib/php/pear/PHP/CodeSniffer.php:623
    0.0141    2448312   6. PHP_CodeSniffer->_expandRulesetReference() /usr/lib/php/pear/PHP/CodeSniffer.php:730

Dump $_GET
Dump $_POST

Variables in local scope (#6):
  $error = 'Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist'
  $isDir = FALSE
  $parts = array (0 => 'PHP53to54', 1 => 'Generic', 2 => 'ForbiddenClassNames')
  $path = FALSE
  $referencedSniffs = array ()
  $sniff = class SimpleXMLElement { 'PHP53to54.Generic.ForbiddenClassNames' }
Ephigenia commented 12 years ago

this is fixed in the new phpcodesniffer version