Skip to content

Commit acecfd8

Browse files
committed
PHP/DiscouragedPHPFunctions: reorganize tests to use empty space and update code comment for namespaced function calls tests
1 parent d3a6532 commit acecfd8

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

WordPress/Tests/PHP/DiscouragedPHPFunctionsUnitTest.inc

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
4-
5-
6-
7-
3+
// Safeguard against false positives on namespaced function calls
4+
MyNamespace\serialize( $value );
5+
\MyNamespace\serialize( $value );
6+
namespace\serialize( $value ); // The sniff should start flagging this once it can resolve relative namespaces.
87

98
serialize(); // Warning.
9+
\serialize( $value ); // Warning.
1010
unserialize(); // Warning.
1111

1212
urlencode(); // Warning.
@@ -42,10 +42,3 @@ $handle = popen( '/bin/ls', 'r' );
4242
class System {}
4343
class Serialize {}
4444

45-
/*
46-
* Safeguard support for PHP 8.0+ tokenization of namespaced "names".
47-
*/
48-
\serialize( $value );
49-
MyNamespace\serialize( $value );
50-
\MyNamespace\serialize( $value );
51-
namespace\serialize( $value ); // The sniff should start flagging this once it can resolve relative namespaces.

WordPress/Tests/PHP/DiscouragedPHPFunctionsUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function getErrorList() {
3737
*/
3838
public function getWarningList() {
3939
return array(
40+
8 => 1,
4041
9 => 1,
4142
10 => 1,
4243
12 => 1,
@@ -60,7 +61,6 @@ public function getWarningList() {
6061
37 => 1,
6162
38 => 1,
6263
39 => 1,
63-
48 => 1,
6464
);
6565
}
6666
}

0 commit comments

Comments
 (0)