Skip to content

Commit ea86386

Browse files
committed
PHP/POSIXFunctions: add tests for namespaced names
1 parent 293e3e3 commit ea86386

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

WordPress/Tests/PHP/POSIXFunctionsUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ list( $year, $month, $day ) = split( ':', $date ); // Bad, split has been deprec
2424
$title_parts = spliti( ' ', get_the_title(), 4 ); // Bad, spliti also deprecated. Use preg_split instead.
2525

2626
sql_regcase( 'Foo - bar.'); // Bad. Deprecated.
27+
28+
/*
29+
* Safeguard correct handling of all types of namespaced function calls.
30+
*/
31+
\split( ':', $date );
32+
MyNamespace\split( ':', $date );
33+
\MyNamespace\split( ':', $date );
34+
namespace\split( ':', $date ); // The sniff should start flagging this once it can resolve relative namespaces.

WordPress/Tests/PHP/POSIXFunctionsUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getErrorList() {
3535
22 => 1,
3636
24 => 1,
3737
26 => 1,
38+
31 => 1,
3839
);
3940
}
4041

0 commit comments

Comments
 (0)