Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal error when running against my project #116

Closed
thekabal opened this issue Mar 13, 2017 · 6 comments
Closed

PHP Fatal error when running against my project #116

thekabal opened this issue Mar 13, 2017 · 6 comments

Comments

@thekabal
Copy link

thekabal commented Mar 13, 2017

Installed using:

        "slevomat/coding-standard": "^2.0",
        "consistence/coding-standard": "^0.13",

and php composer.phar update / php composer.phar install.

Then edited vendor/bin/phpcs.xml to add:

    <rule ref="vendor/consistence/coding-standard/Consistence/ruleset.xml" />
    <rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml" />

Not sure I understand the nature of the error, but its entirely possible that I installed wrong, am running it incorrectly, or that my project (with some code from php-4 days) is triggering an unusual corner case.

$ php vendor/bin/phpcs --standard=vendor/bin/phpcs.xml . --ignore=templates,vendor
PHP Fatal error:  Uncaught SlevomatCodingStandard\Sniffs\Namespaces\NoKeywordsException: Sniff SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff requires an array of keywords set in property keywordsToCheck in /var/www/html/tki/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniff.php:42
Stack trace:
#0 /var/www/html/tki/vendor/squizlabs/php_codesniffer/CodeSniffer.php(1480): SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff->register()
#1 /var/www/html/tki/vendor/squizlabs/php_codesniffer/CodeSniffer.php(595): PHP_CodeSniffer->populateTokenListeners()
#2 /var/www/html/tki/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(956): PHP_CodeSniffer->initStandard(Array, Array, Array)
#3 /var/www/html/tki/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(113): PHP_CodeSniffer_CLI->process()
#4 /var/www/html/tki/vendor/squizlabs/php_codesniffer/scripts/phpcs(25): PHP_CodeSniffer_CLI->runphpcs()
#5 {main}
   in /var/www/html/tki/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniff.php on line 42
@ondrejmirtes
Copy link
Contributor

You need to configure the sniff as said in the error message:

Sniff SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff requires an array of keywords set in property keywordsToCheck

@ondrejmirtes
Copy link
Contributor

You can either exclude the sniff (if you don't want fully qualified names after any keyword) or configure its property.

@thekabal
Copy link
Author

How do I exclude the hint OR configure the keywords?

@thekabal
Copy link
Author

That worked! Many thanks!!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants