Commit 8f928f7
committed
Squiz/ClassFileName: don't error when there is no class name
As things were, the sniff would try to find the next `T_STRING`, but didn't take live coding into account, which means it would end up comparing `$tokens[false]['content']` to the filename, which would end up comparing `<?php` to the file name.
This changes the sniff to use the `File::getDeclarationName()` method instead and verifies we have a usable name to compare against before throwing the error.
Includes test.1 parent ce14c66 commit 8f928f7
File tree
2 files changed
+13
-3
lines changed- src/Standards/Squiz
- Sniffs/Classes
- Tests/Classes
2 files changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | | - | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments