Commit ee2a523
Generic/UpperCaseConstantName: remove special case for double-colon
In early versions of this sniff, constant names were checked not only
when defined, but also when used. At that time, code was added to handle
the dynamic retrieval of class constants in calls to `constant()` by
checking if the constant name contained a double-colon (see
squizlabs/PHP_CodeSniffer@610b0cc
and https://pear.php.net/bugs/bug.php?id=18670). If so, the sniff would
enforce upper case only for the substring after the double-colon.
Later, another commit removed support for constant usage (squizlabs/PHP_CodeSniffer@4af13118b1fedd89faadd78b9bc
and https://pear.php.net/bugs/bug.php?id=20090). It seems to me that the
code that is removed in this commit, should have been removed when
support for constant usage was removed.
The removed code is only triggered when a constant is defined using
`define()`. As far as I can tell, over time, PHP changed how it behaves
when a double-colon is passed as part of the first parameter of
`define()`. However, never in a way that justifies special treatment in
the context of this sniff (https://3v4l.org/erZcK). At least not since
PHP 5.0 (I'm assuming it is not needed to check PHP 4).1 parent eea3af0 commit ee2a523
File tree
1 file changed
+1
-8
lines changed- src/Standards/Generic/Sniffs/NamingConventions
1 file changed
+1
-8
lines changedLines changed: 1 addition & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 118 | + | |
126 | 119 | | |
127 | 120 | | |
128 | 121 | | |
| |||
0 commit comments