You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -683,4 +683,16 @@ class Acronym_AsymmetricVisibilityProperties {
683
683
publicfunction__construct(public protected(set) int$foo = 0) {} // Ok.
684
684
}
685
685
686
+
/*
687
+
* Safeguard correct handling of all types of namespaced function calls.
688
+
*/
689
+
\define('SOME_GLOBAL', [ 1, 2, 3 ]); // Bad.
690
+
MyNamespace\define('SOME_GLOBAL', [ 1, 2, 3 ]); // Ok.
691
+
\MyNamespace\define('SOME_GLOBAL', [ 1, 2, 3 ]); // Ok.
692
+
namespace\define('SOME_GLOBAL', [ 1, 2, 3 ]); // Ok. The sniff should start flagging this once it can resolve relative namespaces.
693
+
\do_action( 'plugin_action' ); // Bad.
694
+
MyNamespace\do_action( 'plugin_action' ); // Ok.
695
+
\MyNamespace\apply_filters( 'plugin_filter', $variable ); // Ok.
696
+
namespace\do_action_ref_array( 'plugin_action', array( $variable ) ); // Ok. The sniff should start flagging this once it can resolve relative namespaces.
\MyNamespace\do_action_ref_array( 'adminHead', array( $variable ) ); // Ok.
131
+
namespace\apply_filters_ref_array( 'adminHead', array( $variable ) ); // Ok. The sniff should start flagging this once it can resolve relative namespaces.
132
+
apply_filters( 'admin_head_' . MyNamespace\my_function('UPPERCASE') . '_action', $variable ); // Ok.
133
+
do_action( 'admin_head_' . \MyNamespace\my_function('UPPERCASE') . '_action' ); // Ok.
if ( namespace\in_array( $_GET['action'], $valid_actions, true ) ) { // Bad, but should become ok once the sniff is able to resolve relative namespaces.
0 commit comments