@@ -61,8 +61,12 @@ discard block |
||
| 61 | 61 | public function open() |
| 62 | 62 | { |
| 63 | 63 | // Some inline stuff that shouldn't error |
| 64 | - if (TRUE) echo 'hello'; |
|
| 65 | - foreach ($tokens as $token) echo $token; |
|
| 64 | + if (TRUE) { |
|
| 65 | + echo 'hello'; |
|
| 66 | + } |
|
| 67 | + foreach ($tokens as $token) { |
|
| 68 | + echo $token; |
|
| 69 | + } |
|
| 66 | 70 | } |
| 67 | 71 | |
| 68 | 72 | /** |
@@ -794,13 +798,18 @@ discard block |
||
| 794 | 798 | elseif ($a == 6) : |
| 795 | 799 | echo "a equals 6"; |
| 796 | 800 | echo "!!!"; |
| 797 | -else : |
|
| 801 | +else { |
|
| 802 | + : |
|
| 798 | 803 | echo "a is neither 5 nor 6"; |
| 804 | +} |
|
| 799 | 805 | endif; |
| 800 | 806 | |
| 801 | 807 | if ($foo): |
| 802 | -if ($bar) $foo = 1; |
|
| 803 | -elseif ($baz) $foo = 2; |
|
| 808 | +if ($bar) { |
|
| 809 | + $foo = 1; |
|
| 810 | +} elseif ($baz) { |
|
| 811 | + $foo = 2; |
|
| 812 | +} |
|
| 804 | 813 | endif; |
| 805 | 814 | |
| 806 | 815 | $this |
@@ -61,8 +61,12 @@ discard block |
||
| 61 | 61 | public function open() |
| 62 | 62 | { |
| 63 | 63 | // Some inline stuff that shouldn't error |
| 64 | - if (TRUE) echo 'hello'; |
|
| 65 | - foreach ($tokens as $token) echo $token; |
|
| 64 | + if (TRUE) { |
|
| 65 | + echo 'hello'; |
|
| 66 | + } |
|
| 67 | + foreach ($tokens as $token) { |
|
| 68 | + echo $token; |
|
| 69 | + } |
|
| 66 | 70 | } |
| 67 | 71 | |
| 68 | 72 | /** |
@@ -794,13 +798,18 @@ discard block |
||
| 794 | 798 | elseif ($a == 6) : |
| 795 | 799 | echo "a equals 6"; |
| 796 | 800 | echo "!!!"; |
| 797 | -else : |
|
| 801 | +else { |
|
| 802 | + : |
|
| 798 | 803 | echo "a is neither 5 nor 6"; |
| 804 | +} |
|
| 799 | 805 | endif; |
| 800 | 806 | |
| 801 | 807 | if ($foo): |
| 802 | -if ($bar) $foo = 1; |
|
| 803 | -elseif ($baz) $foo = 2; |
|
| 808 | +if ($bar) { |
|
| 809 | + $foo = 1; |
|
| 810 | +} elseif ($baz) { |
|
| 811 | + $foo = 2; |
|
| 812 | +} |
|
| 804 | 813 | endif; |
| 805 | 814 | |
| 806 | 815 | $this |
@@ -1,27 +1,40 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ($something) echo 'hello'; |
|
| 3 | +if ($something) { |
|
| 4 | + echo 'hello'; |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | if ($something) { |
| 6 | 8 | echo 'hello'; |
| 7 | -} else echo 'hi'; |
|
| 9 | +} else { |
|
| 10 | + echo 'hi'; |
|
| 11 | +} |
|
| 8 | 12 | |
| 9 | 13 | if ($something) { |
| 10 | 14 | echo 'hello'; |
| 11 | -} else if ($else) echo 'hi'; |
|
| 15 | +} else if ($else) { |
|
| 16 | + echo 'hi'; |
|
| 17 | +} |
|
| 12 | 18 | |
| 13 | -foreach ($something as $thing) echo 'hello'; |
|
| 19 | +foreach ($something as $thing) { |
|
| 20 | + echo 'hello'; |
|
| 21 | +} |
|
| 14 | 22 | |
| 15 | -for ($i; $i > 0; $i--) echo 'hello'; |
|
| 23 | +for ($i; $i > 0; $i--) { |
|
| 24 | + echo 'hello'; |
|
| 25 | +} |
|
| 16 | 26 | |
| 17 | -while ($something) echo 'hello'; |
|
| 27 | +while ($something) { |
|
| 28 | + echo 'hello'; |
|
| 29 | +} |
|
| 18 | 30 | |
| 19 | 31 | do { |
| 20 | 32 | $i--; |
| 21 | 33 | } while ($something); |
| 22 | 34 | |
| 23 | -if(true) |
|
| 35 | +if(true) { |
|
| 24 | 36 | $someObject->{$name}; |
| 37 | +} |
|
| 25 | 38 | |
| 26 | 39 | if (true) : |
| 27 | 40 | $foo = true; |
@@ -42,31 +55,38 @@ discard block |
||
| 42 | 55 | while (!$this->readLine($tokens, $tag)); |
| 43 | 56 | while (!$this->readLine($tokens, $tag)); //skip to end of file |
| 44 | 57 | |
| 45 | -foreach ($cookies as $cookie) |
|
| 58 | +foreach ($cookies as $cookie) { |
|
| 46 | 59 | if ($cookie->match($uri, $matchSessionCookies, $now)) |
| 47 | 60 | $ret[] = $cookie; |
| 61 | +} |
|
| 48 | 62 | |
| 49 | -foreach ($stringParade as $hit) |
|
| 50 | - $hitParade[] = $hit + 0; //cast to integer |
|
| 63 | +foreach ($stringParade as $hit) { |
|
| 64 | + $hitParade[] = $hit + 0; |
|
| 65 | +} |
|
| 66 | +//cast to integer |
|
| 51 | 67 | |
| 52 | 68 | if ($foo) : |
| 53 | 69 | echo 'true'; |
| 54 | 70 | elseif ($something) : |
| 55 | 71 | echo 'foo'; |
| 56 | -else: |
|
| 72 | +else { |
|
| 73 | + : |
|
| 57 | 74 | echo 'false'; |
| 75 | +} |
|
| 58 | 76 | endif; |
| 59 | 77 | |
| 60 | 78 | function test() |
| 61 | 79 | { |
| 62 | - if ($a) |
|
| 63 | - $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : '')); |
|
| 64 | -} |
|
| 80 | + if ($a) { |
|
| 81 | + $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : '')); |
|
| 82 | + } |
|
| 83 | + } |
|
| 65 | 84 | |
| 66 | -if ($a) |
|
| 85 | +if ($a) { |
|
| 67 | 86 | foreach ($b as $c) { |
| 68 | 87 | if ($d) { |
| 69 | 88 | $e=$f; |
| 89 | +} |
|
| 70 | 90 | $g=$h; |
| 71 | 91 | } elseif ($i==0) { |
| 72 | 92 | $j=$k; |
@@ -75,7 +95,8 @@ discard block |
||
| 75 | 95 | |
| 76 | 96 | ?> |
| 77 | 97 | <div style="text-align: right;"> |
| 78 | - <?php if ($model->scenario == 'simple') $widget->renderPager() ?> |
|
| 98 | + <?php if ($model->scenario == 'simple') { |
|
| 99 | + $widget->renderPager() ?> |
|
| 79 | 100 | </div> |
| 80 | 101 | |
| 81 | 102 | <?php |
@@ -83,6 +104,7 @@ discard block |
||
| 83 | 104 | case Shop_Customer :: ERROR_INVALID_GENDER: ?> |
| 84 | 105 | Ungültiges Geschlecht! |
| 85 | 106 | <?php break; |
| 107 | +} |
|
| 86 | 108 | case Shop_Customer :: ERROR_EMAIL_IN_USE: ?> |
| 87 | 109 | Die eingetragene E-Mail-Adresse ist bereits registriert. |
| 88 | 110 | <?php break; |
@@ -95,8 +117,10 @@ discard block |
||
| 95 | 117 | echo 'foo'; |
| 96 | 118 | endswitch; |
| 97 | 119 | endif; |
| 98 | -else: |
|
| 120 | +else { |
|
| 121 | + : |
|
| 99 | 122 | echo 'foo'; |
| 123 | +} |
|
| 100 | 124 | endif; |
| 101 | 125 | |
| 102 | 126 | // ELSE IF split over multiple lines (not inline) |
@@ -117,49 +141,59 @@ discard block |
||
| 117 | 141 | } |
| 118 | 142 | |
| 119 | 143 | $stuff = [1,2,3]; |
| 120 | -foreach($stuff as $num) |
|
| 144 | +foreach($stuff as $num) { |
|
| 121 | 145 | if ($num %2 ) { |
| 122 | 146 | echo "even"; |
| 147 | +} |
|
| 123 | 148 | } else { |
| 124 | 149 | echo "odd"; |
| 125 | 150 | } |
| 126 | 151 | |
| 127 | 152 | $i = 0; |
| 128 | -foreach($stuff as $num) |
|
| 153 | +foreach($stuff as $num) { |
|
| 129 | 154 | do { |
| 130 | 155 | echo $i; |
| 156 | +} |
|
| 131 | 157 | $i++; |
| 132 | 158 | } while ($i < 5); |
| 133 | 159 | |
| 134 | -foreach($stuff as $num) |
|
| 160 | +foreach($stuff as $num) { |
|
| 135 | 161 | if (true) { |
| 136 | 162 | echo "true1\n"; |
| 163 | +} |
|
| 137 | 164 | } |
| 138 | 165 | if (true) { |
| 139 | 166 | echo "true2\n"; |
| 140 | 167 | } |
| 141 | 168 | |
| 142 | -if ($foo) echo 'foo'; |
|
| 143 | -elseif ($bar) echo 'bar'; |
|
| 144 | -else echo 'baz'; |
|
| 169 | +if ($foo) { |
|
| 170 | + echo 'foo'; |
|
| 171 | +} elseif ($bar) { |
|
| 172 | + echo 'bar'; |
|
| 173 | +} else { |
|
| 174 | + echo 'baz'; |
|
| 175 | +} |
|
| 145 | 176 | |
| 146 | 177 | switch ($type) { |
| 147 | 178 | case 1: |
| 148 | 179 | if ($foo) { |
| 149 | 180 | return true; |
| 150 | - } elseif ($baz) |
|
| 151 | - return true; |
|
| 152 | - else { |
|
| 181 | + } elseif ($baz) { |
|
| 182 | + return true; |
|
| 183 | + } else { |
|
| 153 | 184 | echo 'else'; |
| 154 | 185 | } |
| 155 | 186 | break; |
| 156 | 187 | } |
| 157 | 188 | |
| 158 | -foreach ($sql as $s) |
|
| 189 | +foreach ($sql as $s) { |
|
| 159 | 190 | if (!$this->execute) echo "<pre>",$s.";\n</pre>"; |
| 191 | +} |
|
| 160 | 192 | else { |
| 161 | 193 | $ok = $this->connDest->Execute($s); |
| 162 | - if (!$ok) |
|
| 163 | - if ($this->neverAbort) $ret = false; |
|
| 164 | - else return false; |
|
| 194 | + if (!$ok) { |
|
| 195 | + if ($this->neverAbort) $ret = false; |
|
| 196 | + } else { |
|
| 197 | + return false; |
|
| 198 | + } |
|
| 165 | 199 | } |
@@ -4,15 +4,17 @@ |
||
| 4 | 4 | abstract public private protected function whatever() {} |
| 5 | 5 | const array() |
| 6 | 6 | for ($var as $var) { exit; } |
| 7 | -if ($a and $b or $c xor $d) { die; } elseif { } else |
|
| 8 | -goto a; |
|
| 7 | +if ($a and $b or $c xor $d) { die; } elseif { } else { |
|
| 8 | + goto a; |
|
| 9 | +} |
|
| 9 | 10 | |
| 10 | 11 | Class Something EXTENDS SomethingElse implementS Whatever |
| 11 | 12 | Abstract Public Private Protected function whatever() {} |
| 12 | 13 | CONST array() |
| 13 | 14 | For ($var As $var) { Exit; } |
| 14 | -If ($a AND $b OR $c XOR $d) { Die; } ElseIf { } Else |
|
| 15 | -GOTO a; |
|
| 15 | +If ($a AND $b OR $c XOR $d) { Die; } ElseIf { } Else { |
|
| 16 | + GOTO a; |
|
| 17 | +} |
|
| 16 | 18 | function (Array $a) {} |
| 17 | 19 | const PRIVATE; |
| 18 | 20 | HttpStatus::CONTINUE; |
@@ -61,8 +61,12 @@ |
||
| 61 | 61 | public function open() |
| 62 | 62 | { |
| 63 | 63 | // Some inline stuff that shouldn't error |
| 64 | - if (TRUE) echo 'hello'; |
|
| 65 | - foreach ($tokens as $token) echo $token; |
|
| 64 | + if (TRUE) { |
|
| 65 | + echo 'hello'; |
|
| 66 | + } |
|
| 67 | + foreach ($tokens as $token) { |
|
| 68 | + echo $token; |
|
| 69 | + } |
|
| 66 | 70 | } |
| 67 | 71 | |
| 68 | 72 | /** |
@@ -101,19 +101,22 @@ discard block |
||
| 101 | 101 | ){ |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | -if ($condition1) |
|
| 104 | +if ($condition1) { |
|
| 105 | 105 | echo 'bar'; |
| 106 | +} |
|
| 106 | 107 | |
| 107 | 108 | if ($condition1 |
| 108 | 109 | || $condition2 |
| 109 | -|| $condition3) |
|
| 110 | +|| $condition3) { |
|
| 110 | 111 | echo 'bar'; |
| 112 | +} |
|
| 111 | 113 | |
| 112 | 114 | |
| 113 | 115 | if ($condition1 |
| 114 | 116 | || $condition2 || $condition3 |
| 115 | -) |
|
| 117 | +) { |
|
| 116 | 118 | echo 'bar'; |
| 119 | +} |
|
| 117 | 120 | |
| 118 | 121 | if (!empty($post) |
| 119 | 122 | && (!empty($context['header']) |
@@ -142,18 +145,22 @@ discard block |
||
| 142 | 145 | endif; |
| 143 | 146 | |
| 144 | 147 | if ($IPP->errorCode() == 401 || // comment |
| 145 | - $IPP->errorCode() == 3200) /* long comment |
|
| 148 | + $IPP->errorCode() == 3200) { |
|
| 149 | + /* long comment |
|
| 146 | 150 | here |
| 147 | 151 | */ |
| 148 | 152 | { |
| 149 | 153 | return false; |
| 150 | 154 | } |
| 155 | +} |
|
| 151 | 156 | |
| 152 | 157 | if ($IPP->errorCode() == 401 || // comment |
| 153 | - $IPP->errorCode() == 3200) // long comment here |
|
| 158 | + $IPP->errorCode() == 3200) { |
|
| 159 | + // long comment here |
|
| 154 | 160 | { |
| 155 | 161 | return false; |
| 156 | 162 | } |
| 163 | +} |
|
| 157 | 164 | |
| 158 | 165 | if ($IPP->errorCode() == 401 |
| 159 | 166 | // Comment explaining the next condition here. |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | if ($i == 0) { |
| 83 | 83 | $i = 1; |
| 84 | -}else{ |
|
| 84 | +} else{ |
|
| 85 | 85 | $i = 0; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | if ($i == 0) { |
| 99 | 99 | $i = 1; |
| 100 | -}else{ |
|
| 100 | +} else{ |
|
| 101 | 101 | $i = 0; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | if ($i == 0) { |
| 121 | 121 | $i = 1; |
| 122 | -}else if($i == 2){ |
|
| 122 | +} else if($i == 2){ |
|
| 123 | 123 | $i = 0; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if ($i == 0) { |
| 127 | 127 | $i = 1; |
| 128 | -}elseif($i == 2){ |
|
| 128 | +} elseif($i == 2){ |
|
| 129 | 129 | $i = 0; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -153,7 +153,6 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if ($i == 0) { |
| 156 | -} |
|
| 157 | -else { |
|
| 156 | +} else { |
|
| 158 | 157 | } |
| 159 | 158 | ?> |
| 160 | 159 | \ No newline at end of file |
@@ -69,7 +69,9 @@ |
||
| 69 | 69 | class Test |
| 70 | 70 | { |
| 71 | 71 | public function test() { |
| 72 | - if (1) 1; |
|
| 72 | + if (1) { |
|
| 73 | + 1; |
|
| 74 | + } |
|
| 73 | 75 | 1 ? (1 ? 1 : 1) : 1; |
| 74 | 76 | } |
| 75 | 77 | } |
@@ -105,8 +105,12 @@ |
||
| 105 | 105 | |
| 106 | 106 | }//end class |
| 107 | 107 | |
| 108 | -if ($index < -1) $index = 0; |
|
| 109 | -if ($index < - 1) $index = 0; |
|
| 108 | +if ($index < -1) { |
|
| 109 | + $index = 0; |
|
| 110 | +} |
|
| 111 | +if ($index < - 1) { |
|
| 112 | + $index = 0; |
|
| 113 | +} |
|
| 110 | 114 | |
| 111 | 115 | $three = ceil($one / $two); |
| 112 | 116 | $three = ceil(($one / $two) / $four); |