File tree Expand file tree Collapse file tree 3 files changed +62
-1
lines changed
PHP_CodeSniffer/Tokenizers Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 33 <description >Magento Coding Standard</description >
44
55 <!-- File extensions to be checked. -->
6- <arg name =" extensions" value =" php,phtml" />
6+ <arg name =" extensions" value =" php,phtml,graphqls/GraphQL " />
77
88 <!-- Severity 10 errors: Critical code issues. -->
99 <rule ref =" Generic.Functions.CallTimePassByReference" >
522522 <rule ref =" Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" >
523523 <severity >0</severity >
524524 </rule >
525+ <rule ref =" Magento2.GraphQL.ValidTypeName" >
526+ <severity >6</severity >
527+ <type >warning</type >
528+ </rule >
525529
526530 <!-- Severity 5 warnings: PHPDoc formatting and commenting issues. -->
527531 <rule ref =" Magento2.Commenting.ClassAndInterfacePHPDocFormatting" >
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+
7+ namespace PHP_CodeSniffer \Tokenizers ;
8+
9+ use PHP_CodeSniffer \Config ;
10+
11+ /**
12+ * Implements a tokenizer for GraphQL files.
13+ */
14+ class GraphQL extends JS
15+ {
16+
17+ protected $ additionalTokenValues = [
18+ 'type ' => 'T_CLASS ' ,
19+ 'interface ' => 'T_CLASS ' ,
20+ 'enum ' => 'T_CLASS ' ,
21+ '# ' => 'T_COMMENT ' ,
22+ ];
23+
24+ /**
25+ * Constructor.
26+ *
27+ * @param string $content
28+ * @param Config $config
29+ * @param string $eolChar
30+ * @throws \PHP_CodeSniffer\Exceptions\TokenizerException
31+ */
32+ public function __construct ($ content , Config $ config , $ eolChar = '\n ' )
33+ {
34+ //add our token values
35+ $ this ->tokenValues = array_merge (
36+ $ this ->tokenValues ,
37+ $ this ->additionalTokenValues
38+ );
39+
40+ //let parent do its job (which will start tokenizing)
41+ parent ::__construct ($ content , $ config , $ eolChar );
42+ }
43+
44+ /**
45+ * @inheritDoc
46+ */
47+ public function processAdditional ()
48+ {
49+ //NOP Does nothing intentionally
50+ }
51+
52+ }
Original file line number Diff line number Diff line change 1414 "require-dev" : {
1515 "phpunit/phpunit" : " ^4.0 || ^5.0 || ^6.0 || ^7.0"
1616 },
17+ "autoload" : {
18+ "classmap" : [
19+ " PHP_CodeSniffer/Tokenizers/"
20+ ]
21+ },
1722 "scripts" : {
1823 "post-install-cmd" : " vendor/bin/phpcs --config-set installed_paths ../../.." ,
1924 "post-update-cmd" : " vendor/bin/phpcs --config-set installed_paths ../../.."
You can’t perform that action at this time.
0 commit comments