Commit 3b9282a
authored
Fix possible index error in NonExecutableCodeSniff
I was running into this while working on another sniff. One trivial example I found to demonstrate the bug is `<?php return array_map(`. This can happen when PHPCS runs on a file I'm currently typing in, but the file is not complete yet.
I believe it's safe to assume the 'parenthesis_closer' array key only exists on T_OPEN_PARENTHESIS tokens, and the 'bracket_closer' key only on T_OPEN_CURLY_BRACKET tokens. I had a quick look at the tokenizer and I believe this is indeed the case. But I might be wrong.
Sorry for not providing a test. I would love to, but I'm not familiar enough with the test setup here.1 parent 75ff420 commit 3b9282a
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
0 commit comments