Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ apply_filters( $_REQUEST['else'] ); // Warning.

class Acronym_Dynamic_Hooks {
const FILTER = 'acronym';
const FILTER_WITH_UNDERSCORE = 'acronym_';
const ?string FILTER_WITH_UNDERSCORE = 'acronym_';

protected $filter = 'acronym';
protected $filter_with_underscore = 'acronym_';
Expand Down
13 changes: 13 additions & 0 deletions WordPress/Tests/WP/CapitalPDangitUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,16 @@ echo Some\Enum\WordPress::ENUM_CONSTANT;

// Safeguard that the sniff doesn't act on anonymous classes.
$anon = new class() {};

/*
* Safeguard that PHP 8.3+ typed class constants are handled correctly (i.e. ignored).
*/
class TypeClassConstants {
public const string WORDPRESS = 'wordress';

public const ?string ANOTHER = 'value',
WORDPRESS_SOMETHING = 'wordpress';

// Ensures no false positives on incorrect casing in a class constant type name.
public const (\Fully\Qualified\MyClass&wordPRESS)|string ANOTHER_WORDPRESS = 'wordpress';
}
13 changes: 13 additions & 0 deletions WordPress/Tests/WP/CapitalPDangitUnitTest.1.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,16 @@ echo Some\Enum\WordPress::ENUM_CONSTANT;

// Safeguard that the sniff doesn't act on anonymous classes.
$anon = new class() {};

/*
* Safeguard that PHP 8.3+ typed class constants are handled correctly (i.e. ignored).
*/
class TypeClassConstants {
public const string WORDPRESS = 'wordress';

public const ?string ANOTHER = 'value',
WORDPRESS_SOMETHING = 'wordpress';

// Ensures no false positives on incorrect casing in a class constant type name.
public const (\Fully\Qualified\MyClass&wordPRESS)|string ANOTHER_WORDPRESS = 'wordpress';
}
Loading