-
-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathAssignmentInConditionUnitTest.1.inc
More file actions
106 lines (86 loc) · 2.03 KB
/
Copy pathAssignmentInConditionUnitTest.1.inc
File metadata and controls
106 lines (86 loc) · 2.03 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
// OK.
if ($a === 123) {
} elseif ($a == 123) {
} elseif ($a !== 123) {
} elseif ($a != 123) {}
function abc( $a = 'default' ) {}
if (in_array( $a, array( 1 => 'a', 2 => 'b' ) ) ) {}
switch ( $a === $b ) {}
switch ( true ) {
case $sample == 'something':
break;
}
for ( $i = 0; $i == 100; $i++ ) {}
for ( $i = 0; $i >= 100; $i++ ) {}
for ( $i = 0; ; $i++ ) {}
for (;;) {}
do {
} while ( $sample == false );
while ( $sample === false ) {}
// Silly, but not an assignment.
if (123 = $a) {}
if (strtolower($b) = $b) {}
if (array( 1 => 'a', 2 => 'b' ) = $b) {}
if (SOME_CONSTANT = 123) {
} else if(self::SOME_CONSTANT -= 10) {}
if ( $a() = 123 ) {
} else if ( $b->something() = 123 ) {
} elseif ( $c::something() = 123 ) {}
switch ( true ) {
case 'something' = $sample:
break;
}
// Assignments in condition.
if ($a = 123) {
} elseif ($a = 'abc') {
} else if( $a += 10 ) {
} else if($a -= 10) {
} else if($a *= 10) {
} else if($a **= 10) {
} else if($a /= 10) {
} else if($a .= strtolower($b)) {
} else if($a %= SOME_CONSTANT) {
} else if($a &= 2) {
} else if($a |= 2) {
} else if($a ^= 2) {
} else if($a <<= 2) {
} else if($a >>= 2) {
} else if($a ??= $b) {
} elseif( $a = 'abc' && $b = 'def' ) {
} elseif(
$a = 'abc'
&& $a .= 'def'
) {}
if ($a[] = 123) {
} elseif ($a['something'] = 123) {
} elseif (self::$a = 123) {
} elseif (parent::$a *= 123) {
} elseif (static::$a = 123) {
} elseif (MyClass::$a .= 'abc') {
} else if( $this->something += 10 ) {}
switch ( $a = $b ) {}
switch ( true ) {
case $sample = 'something':
break;
case $sample = 'something' && $a = $b;
break;
}
for ( $i = 0; $i = 100; $i++ ) {}
for ( $i = 0; $i = 100 && $b = false; $i++ ) {}
do {
} while ( $sample = false );
while ( $sample = false ) {}
if ($a = 123) :
endif;
match ($a[0] = 123) {};
switch ( true ) {
case $sample = 'something': {
break;
}
case $sample ?>
<?php $a = $b ?><!-- This is okay, this is in the case body, not the condition. -->
<?php break;
case $sample = 'something' && $a = $b ?>
<?php break;
}