Commit a4d02dd
committed
Tokenizer/PHP: more context sensitive keyword fixes
PHPCS re-tokenizes the `self`, `parent`, `true`, `false` and `null` keywords to a PHPCS native token.
This re-tokenization did not take the following situations into account:
* Those keywords being used as function names when the function is declared to return by reference.
* Those keywords being used as a function call.
Additionally, the PHP native `T_STATIC` token would not be (re-)tokenized to `T_STRING` when used as a function call, though it was tokenized correctly when used as a method call..
While using the `static` keyword for a global function declaration is illegal in PHP, the tokenization in PHPCS should still be consistent.
This commit fixes those issues.
Includes additional unit tests.1 parent ed8e00d commit a4d02dd
File tree
3 files changed
+341
-251
lines changed- src/Tokenizers
- tests/Core/Tokenizer
3 files changed
+341
-251
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
684 | 714 | | |
685 | 715 | | |
686 | 716 | | |
| |||
2103 | 2133 | | |
2104 | 2134 | | |
2105 | 2135 | | |
2106 | | - | |
2107 | | - | |
2108 | | - | |
2109 | | - | |
2110 | | - | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
2122 | 2149 | | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
2123 | 2160 | | |
2124 | | - | |
2125 | | - | |
2126 | | - | |
| 2161 | + | |
2127 | 2162 | | |
2128 | 2163 | | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
2129 | 2181 | | |
2130 | | - | |
2131 | 2182 | | |
2132 | 2183 | | |
| 2184 | + | |
2133 | 2185 | | |
2134 | | - | |
2135 | 2186 | | |
2136 | | - | |
2137 | | - | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
2138 | 2190 | | |
2139 | 2191 | | |
2140 | 2192 | | |
| |||
0 commit comments