Commit 060338f
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 a7d8693 commit 060338f
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 | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
0 commit comments