Commit bd0af7a
committed
Generic/DuplicateClassName: performance fix
As things were, the sniff would unconditionally walk a complete file, making it one of the top 15 slowest sniffs.
However, OO structures in PHP cannot be nested, so once we've found an OO declaration, we can skip to the end of it before continuing the token walking. See: https://3v4l.org/pbSTG
This small tweak makes a significant difference in the sniff performance without any impact on the sniff results.1 parent 2e98c74 commit bd0af7a
File tree
1 file changed
+4
-0
lines changed- src/Standards/Generic/Sniffs/Classes
1 file changed
+4
-0
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
| |||
0 commit comments