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

NoKeywordsException #7

Closed
Petah opened this issue Dec 23, 2015 · 4 comments
Closed

NoKeywordsException #7

Petah opened this issue Dec 23, 2015 · 4 comments
Labels

Comments

@Petah
Copy link

Petah commented Dec 23, 2015

Doesn't seem to work out of the box.

I added the 2 deps to composer, added the sample ruleset, and ran the example command, then got the error below.

dneilsen:rhino-debug davidneilsen$ vendor/bin/parallel-lint classes
PHP 7.0.0 | 10 parallel jobs
..........                                                   10/10 (100 %)


Checked 10 files in 0 seconds
No syntax error found
dneilsen:rhino-debug davidneilsen$ vendor/bin/phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp classes
PHP Fatal error:  Uncaught SlevomatCodingStandard\Sniffs\Namespaces\NoKeywordsException: Sniff SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff requires an array of keywords set in property keywordsToCheck in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniff.php:43
Stack trace:
#0 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer.php(1394): SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff->register()
#1 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer.php(561): PHP_CodeSniffer->populateTokenListeners()
#2 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(818): PHP_CodeSniffer->initStandard(Array, Array)
#3 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(95): PHP_CodeSniffer_CLI->process()
 in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniff.php on line 43

Fatal error: Uncaught SlevomatCodingStandard\Sniffs\Namespaces\NoKeywordsException: Sniff SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff requires an array of keywords set in property keywordsToCheck in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniff.php:43
Stack trace:
#0 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer.php(1394): SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff->register()
#1 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer.php(561): PHP_CodeSniffer->populateTokenListeners()
#2 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(818): PHP_CodeSniffer->initStandard(Array, Array)
#3 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(95): PHP_CodeSniffer_CLI->process()
 in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniff.php on line 43
@ondrejmirtes
Copy link
Contributor

Well, I think the exception message is quite obvious: Sniff
SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff
requires an array of keywords set in property keywordsToCheck

You can either ignore this sniff (as described in README) or set after
which keywords you require fully qualified namespaces.

On Wednesday, December 23, 2015, David Neilsen [email protected]
wrote:

Doesn't seem to work out of the box

I added the 2 deps to composer, added the sample ruleset, and ran the
example command, then got the error below

dneilsen:rhino-debug davidneilsen$ vendor/bin/parallel-lint classes
PHP 700 | 10 parallel jobs
10/10 (100 %)

Checked 10 files in 0 seconds
No syntax error found
dneilsen:rhino-debug davidneilsen$ vendor/bin/phpcs --standard=rulesetxml --extensions=php --encoding=utf-8 --tab-width=4 -sp classes
PHP Fatal error: Uncaught SlevomatCodingStandard\Sniffs\Namespaces\NoKeywordsException: Sniff SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff requires an array of keywords set in property keywordsToCheck in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniffphp:43
Stack trace:
#0 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSnifferphp(1394): SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff->register()
#1 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSnifferphp(561): PHP_CodeSniffer->populateTokenListeners()
#2 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLIphp(818): PHP_CodeSniffer->initStandard(Array, Array)
#3 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLIphp(95): PHP_CodeSniffer_CLI->process()
in /Users/davidneilsen/work/rhino/rhino-debug/vendor/

slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniffphp on line 43

Fatal error: Uncaught SlevomatCodingStandard\Sniffs\Namespaces\NoKeywordsException: Sniff SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff requires an array of keywords set in property keywordsToCheck in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniffphp:43
Stack trace:
#0 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSnifferphp(1394): SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedClassNameAfterKeywordSniff->register()
#1 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSnifferphp(561): PHP_CodeSniffer->populateTokenListeners()
#2 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLIphp(818): PHP_CodeSniffer->initStandard(Array, Array)
#3 /Users/davidneilsen/work/rhino/rhino-debug/vendor/squizlabs/php_codesniffer/CodeSniffer/CLIphp(95): PHP_CodeSniffer_CLI->process()
in /Users/davidneilsen/work/rhino/rhino-debug/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameAfterKeywordSniffphp on line 43


Reply to this email directly or view it on GitHub
#7.

Ondřej Mirtes

@Petah
Copy link
Author

Petah commented Dec 23, 2015

So maybe more of a docs issue then? I just followed the "Using the standard as a whole" part. How do I add these extra requirements?

@ondrejmirtes
Copy link
Contributor

There's no one correct setting. When adopting this standard, you should consider how your codebase currently looks and customize the settings for that. So if you currently don't require FQN after some keyword, you should ignore this sniff. Ignoring sniffs is described here.

If you want to adopt this sniff and require FQN after extends/implements, it's described in the according section of the README dedicated to this sniff.

@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 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants