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
9 changes: 9 additions & 0 deletions WordPress/Tests/WP/CapitalPDangitUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,12 @@ class TypeClassConstants {
// Ensures no false positives on incorrect casing in a class constant type name.
public const (\Fully\Qualified\MyClass&wordPRESS)|string ANOTHER_WORDPRESS = 'wordpress';
}

/*
* Safeguard correct handling of all types of namespaced calls to the define() function.
*/
\DEFINE( 'WORDPRESS_SOMETHING', 'wordpress' ); // OK.
MyNamespace\define( 'WORDPRESS_SOMETHING', 'wordpress' ); // Bad.
\MyNamespace\Define( 'WORDPRESS_SOMETHING', 'wordpress' ); // Bad.
namespace\Sub\define( 'WORDPRESS_SOMETHING', 'wordpress' ); // Bad.
namespace\define( 'WORDPRESS_SOMETHING', 'wordpress' ); // The sniff should stop flagging this once it can resolve relative namespaces.
9 changes: 9 additions & 0 deletions WordPress/Tests/WP/CapitalPDangitUnitTest.1.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,12 @@ class TypeClassConstants {
// Ensures no false positives on incorrect casing in a class constant type name.
public const (\Fully\Qualified\MyClass&wordPRESS)|string ANOTHER_WORDPRESS = 'wordpress';
}

/*
* Safeguard correct handling of all types of namespaced calls to the define() function.
*/
\DEFINE( 'WORDPRESS_SOMETHING', 'wordpress' ); // OK.
MyNamespace\define( 'WORDPRESS_SOMETHING', 'WordPress' ); // Bad.
\MyNamespace\Define( 'WORDPRESS_SOMETHING', 'WordPress' ); // Bad.
namespace\Sub\define( 'WORDPRESS_SOMETHING', 'WordPress' ); // Bad.
namespace\define( 'WORDPRESS_SOMETHING', 'WordPress' ); // The sniff should stop flagging this once it can resolve relative namespaces.
4 changes: 4 additions & 0 deletions WordPress/Tests/WP/CapitalPDangitUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public function getWarningList( $testFile = '' ) {
204 => 1,
205 => 1,
224 => 1,
252 => 1,
253 => 1,
254 => 1,
255 => 1,
);

case 'CapitalPDangitUnitTest.2.inc':
Expand Down
Loading