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 3
3
<description >Magento Coding Standard</description >
4
4
5
5
<!-- File extensions to be checked. -->
6
- <arg name =" extensions" value =" php,phtml" />
6
+ <arg name =" extensions" value =" php,phtml,graphqls/GraphQL " />
7
7
8
8
<!-- Severity 10 errors: Critical code issues. -->
9
9
<rule ref =" Generic.Functions.CallTimePassByReference" >
522
522
<rule ref =" Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" >
523
523
<severity >0</severity >
524
524
</rule >
525
+ <rule ref =" Magento2.GraphQL.ValidTypeName" >
526
+ <severity >6</severity >
527
+ <type >warning</type >
528
+ </rule >
525
529
526
530
<!-- Severity 5 warnings: PHPDoc formatting and commenting issues. -->
527
531
<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 14
14
"require-dev" : {
15
15
"phpunit/phpunit" : " ^4.0 || ^5.0 || ^6.0 || ^7.0"
16
16
},
17
+ "autoload" : {
18
+ "classmap" : [
19
+ " PHP_CodeSniffer/Tokenizers/"
20
+ ]
21
+ },
17
22
"scripts" : {
18
23
"post-install-cmd" : " vendor/bin/phpcs --config-set installed_paths ../../.." ,
19
24
"post-update-cmd" : " vendor/bin/phpcs --config-set installed_paths ../../.."
You can’t perform that action at this time.
0 commit comments