@@ -49,43 +49,6 @@ public static function invalidPhpDocChecker(string $contents, Result $result): v
4949 }
5050
5151
52- public static function shortArraySyntaxFixer (string &$ contents , Result $ result ): void
53- {
54- $ out = '' ;
55- $ brackets = [];
56- try {
57- $ tokens = @token_get_all ($ contents , TOKEN_PARSE ); // @ can trigger error
58- } catch (\ParseError ) {
59- return ;
60- }
61-
62- for ($ i = 0 ; $ i < count ($ tokens ); $ i ++) {
63- $ token = $ tokens [$ i ];
64- if ($ token === '( ' ) {
65- $ brackets [] = false ;
66-
67- } elseif ($ token === ') ' ) {
68- $ token = array_pop ($ brackets ) ? '] ' : ') ' ;
69-
70- } elseif (is_array ($ token ) && $ token [0 ] === T_ARRAY ) {
71- $ a = $ i + 1 ;
72- if (isset ($ tokens [$ a ]) && $ tokens [$ a ][0 ] === T_WHITESPACE ) {
73- $ a ++;
74- }
75- if (isset ($ tokens [$ a ]) && $ tokens [$ a ] === '( ' ) {
76- $ result ->fix ('uses old array() syntax ' , $ token [2 ]);
77- $ i = $ a ;
78- $ brackets [] = true ;
79- $ token = '[ ' ;
80- }
81- }
82- $ out .= is_array ($ token ) ? $ token [1 ] : $ token ;
83- }
84-
85- $ contents = $ out ;
86- }
87-
88-
8952 public static function strictTypesDeclarationChecker (string $ contents , Result $ result ): void
9053 {
9154 $ declarations = '' ;
@@ -108,23 +71,6 @@ public static function strictTypesDeclarationChecker(string $contents, Result $r
10871 }
10972
11073
111- public static function invalidDoubleQuotedStringChecker (string $ contents , Result $ result ): void
112- {
113- $ prev = [0 , '' , 0 ];
114- foreach (@token_get_all ($ contents ) as $ token ) { // @ can trigger error
115- if (($ token [0 ] === T_ENCAPSED_AND_WHITESPACE && ($ prev [0 ] !== T_START_HEREDOC || !strpos ($ prev [1 ], "' " )))
116- || ($ token [0 ] === T_CONSTANT_ENCAPSED_STRING && $ token [1 ][0 ] === '" ' )
117- ) {
118- $ m = Strings::match ($ token [1 ], '#^([^ \\\]| \\\[ \\\nrtvefxu0-7\W])*+# ' ) ?? ['' ]; // more strict: '#^([^\\\\]|\\\\[\\\\nrtvefu$"x0-7])*+#'
119- if ($ token [1 ] !== $ m [0 ]) {
120- $ result ->warning ('Invalid escape sequence ' . substr ($ token [1 ], strlen ($ m [0 ]), 2 ) . ' in double quoted string ' , $ token [2 ]);
121- }
122- }
123- $ prev = $ token ;
124- }
125- }
126-
127-
12874 public static function docSyntaxtHinter (string $ contents , Result $ result ): void
12975 {
13076 $ prev = [0 , '' , 0 ];
0 commit comments