-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathDynamicCallsUnitTest.1.inc
More file actions
48 lines (36 loc) · 1.41 KB
/
DynamicCallsUnitTest.1.inc
File metadata and controls
48 lines (36 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
function my_test() {
echo esc_html( "foo" );
}
$irrelevant = 10;
$my_notokay_func = 'extract';
$my_notokay_func(); // Bad.
$my_okay_func = 'my_test';
$my_okay_func(); // OK.
$test_with_comment /*comment*/ = 'func_get_args';
$test_with_comment /*comment*/ (); // Bad.
$test_getting_the_actual_value_1 = function_call( 'extract' );
$test_getting_the_actual_value_1(); // OK. Unclear what the actual variable value will be.
$test_getting_the_actual_value_2 = $array['compact'];
$test_getting_the_actual_value_2(); // OK. Unclear what the actual variable value will be.
$test_getting_the_actual_value_3 = 10 ?>
<div>html</div>
<?php
echo 'extract';
$test_getting_the_actual_value_3(); // OK. Broken function call, but not calling extract().
$test_getting_the_actual_value_4 = 'get_defined_vars' . $source;
$test_getting_the_actual_value_4(); // OK. Unclear what the actual variable value will be.
$ensure_no_notices_are_thrown_on_parse_error = /*comment*/ ;
$test_double_quoted_string = "assert";
$test_double_quoted_string(); // Bad.
function hasStaticVars() {
static $staticvar_foo = 'irrelevant', $staticvar_bar = 'func_num_args', $staticvar_baz = 'nothing';
$staticvar_foo(); // OK.
$staticvar_bar(); // Bad.
$staticvar_baz(); // OK.
}
function functionParams( $param_foo = 'func_get_arg', $param_bar = 'nothing', $param_baz = 'func_num_args') {
$param_foo(); // Bad.
$param_bar(); // OK.
$param_baz(); // Bad.
}