Skip to content

Commit 4197cea

Browse files
committed
PHP/RestrictedPHPFunctions: add tests for namespaced names
1 parent ea86386 commit 4197cea

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

WordPress/Tests/PHP/RestrictedPHPFunctionsUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
add_action( 'widgets_init', create_function( '', // Error.
44
'return register_widget( "time_more_on_time_widget" );'
55
) );
6+
7+
/*
8+
* Safeguard correct handling of all types of namespaced function calls.
9+
*/
10+
\create_function('', 'return;');
11+
MyNamespace\create_function('', 'return;');
12+
\MyNamespace\create_function('', 'return;');
13+
namespace\create_function('', 'return;'); // The sniff should start flagging this once it can resolve relative namespaces.

WordPress/Tests/PHP/RestrictedPHPFunctionsUnitTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ final class RestrictedPHPFunctionsUnitTest extends AbstractSniffUnitTest {
2727
*/
2828
public function getErrorList() {
2929
return array(
30-
3 => 1,
30+
3 => 1,
31+
10 => 1,
3132
);
3233
}
3334

0 commit comments

Comments
 (0)