File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ apply_filters( $_REQUEST['else'] ); // Warning.
276276
277277class Acronym_Dynamic_Hooks {
278278 const FILTER = 'acronym ' ;
279- const FILTER_WITH_UNDERSCORE = 'acronym_ ' ;
279+ const ? string FILTER_WITH_UNDERSCORE = 'acronym_ ' ;
280280
281281 protected $ filter = 'acronym ' ;
282282 protected $ filter_with_underscore = 'acronym_ ' ;
Original file line number Diff line number Diff line change @@ -231,3 +231,16 @@ echo Some\Enum\WordPress::ENUM_CONSTANT;
231231
232232// Safeguard that the sniff doesn't act on anonymous classes.
233233$ anon = new class () {};
234+
235+ /*
236+ * Safeguard that PHP 8.3+ typed class constants are handled correctly (i.e. ignored).
237+ */
238+ class TypeClassConstants {
239+ public const string WORDPRESS = 'wordress ' ;
240+
241+ public const ?string ANOTHER = 'value ' ,
242+ WORDPRESS_SOMETHING = 'wordpress ' ;
243+
244+ // Ensures no false positives on incorrect casing in a class constant type name.
245+ public const (\Fully \Qualified \MyClass &wordPRESS )|string ANOTHER_WORDPRESS = 'wordpress ' ;
246+ }
Original file line number Diff line number Diff line change @@ -231,3 +231,16 @@ echo Some\Enum\WordPress::ENUM_CONSTANT;
231231
232232// Safeguard that the sniff doesn't act on anonymous classes.
233233$anon = new class() {};
234+
235+ /*
236+ * Safeguard that PHP 8.3+ typed class constants are handled correctly (i.e. ignored).
237+ */
238+ class TypeClassConstants {
239+ public const string WORDPRESS = 'wordress';
240+
241+ public const ?string ANOTHER = 'value',
242+ WORDPRESS_SOMETHING = 'wordpress';
243+
244+ // Ensures no false positives on incorrect casing in a class constant type name.
245+ public const (\Fully\Qualified\MyClass&wordPRESS)|string ANOTHER_WORDPRESS = 'wordpress';
246+ }
You can’t perform that action at this time.
0 commit comments