Commit ad45d8a
committed
Generic/ConstructorName: fix minor bug
This commit fixes a minor bug in `Generic.NamingConventions
.ConstructorName` when checking if a given class has a parent. The code
was checking if the lower case version of the value returned by
`File::findExtendedClassName()`` is `false`. The problem is that
`strtolower()` never returns `false`, it always returns a `string`.
Thus, the condition would never evaluate to `true` and the sniff would
not bail at this point when a given class has no parent.
This did not cause any issues to the sniff, even for invalid code, as
there is not a scenario where a class method can have a `T_DOUBLE_COLON`
token followed by a `T_STRING` token with an empty `content`. This is
true even for empty strings as PHPCS includes the quotes in the
`content`.1 parent 8a7ee56 commit ad45d8a
File tree
1 file changed
+4
-2
lines changed- src/Standards/Generic/Sniffs/NamingConventions
1 file changed
+4
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | | - | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
0 commit comments