Skip to content

Commit 293e3e3

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

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

WordPress/Tests/PHP/DontExtractUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ my_extract(); // Ok.
77
My_Object::extract(); // Ok.
88
$this->extract(); // Ok.
99
$my_object->extract(); // Ok.
10+
11+
/*
12+
* Safeguard correct handling of all types of namespaced function calls.
13+
*/
14+
\extract( array( 'a' => 1 ) );
15+
MyNamespace\extract( array( 'a' => 1 ) );
16+
\MyNamespace\extract( array( 'a' => 1 ) );
17+
namespace\extract( array( 'a' => 1 ) ); // The sniff should start flagging this once it can resolve relative namespaces.

WordPress/Tests/PHP/DontExtractUnitTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ final class DontExtractUnitTest extends AbstractSniffUnitTest {
2929
*/
3030
public function getErrorList() {
3131
return array(
32-
3 => 1,
32+
3 => 1,
33+
14 => 1,
3334
);
3435
}
3536

0 commit comments

Comments
 (0)