@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function getWarningList() |
55 | 55 | { |
56 | - return [51 => 1]; |
|
56 | + return [ 51 => 1 ]; |
|
57 | 57 | |
58 | 58 | }//end getWarningList() |
59 | 59 |
@@ -35,16 +35,16 @@ |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | // These should all be flagged for wrong whitespace before opening brace. |
38 | -interface Test_Interface_Bad_C { |
|
38 | +interface Test_Interface_Bad_C { |
|
39 | 39 | } |
40 | 40 | |
41 | -class Test_Class_Bad_G { |
|
41 | +class Test_Class_Bad_G { |
|
42 | 42 | } |
43 | 43 | |
44 | -class Test_Class_Bad_H extends Test_Class_Bad_G { |
|
44 | +class Test_Class_Bad_H extends Test_Class_Bad_G { |
|
45 | 45 | } |
46 | 46 | |
47 | -class Test_Class_Bad_I implements Test_Interface_Bad_C{ |
|
47 | +class Test_Class_Bad_I implements Test_Interface_Bad_C { |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // This one should be flagged as a potential parse error. |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return []; |
|
28 | + return [ ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return array<int, int> |
42 | 42 | */ |
43 | - public function getWarningList($testFile='') |
|
43 | + public function getWarningList( $testFile = '' ) |
|
44 | 44 | { |
45 | - switch ($testFile) { |
|
45 | + switch ( $testFile ) { |
|
46 | 46 | case 'DuplicateClassNameUnitTest.1.inc': |
47 | 47 | return [ |
48 | 48 | 8 => 1, |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | ]; |
65 | 65 | break; |
66 | 66 | case 'DuplicateClassNameUnitTest.6.inc': |
67 | - return [10 => 1]; |
|
67 | + return [ 10 => 1 ]; |
|
68 | 68 | break; |
69 | 69 | default: |
70 | - return []; |
|
70 | + return [ ]; |
|
71 | 71 | break; |
72 | 72 | }//end switch |
73 | 73 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | -class Test{ |
|
3 | - public function testOne(){ |
|
2 | +class Test { |
|
3 | + public function testOne() { |
|
4 | 4 | ?> |
5 | 5 | <p>some html here</p> |
6 | 6 | <?php |
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | -class Test{ |
|
10 | +class Test { |
|
11 | 11 | |
12 | 12 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | function_call(); // OK. |
7 | 7 | |
8 | 8 | // The below examples are all bad. |
9 | -function_call();; |
|
9 | +function_call(); ; |
|
10 | 10 | |
11 | 11 | function_call(); |
12 | 12 | ; |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | /* some comment */; |
16 | 16 | |
17 | 17 | function_call(); |
18 | -/* some comment */ ; |
|
18 | +/* some comment */; |
|
19 | 19 | |
20 | 20 | ?> |
21 | -<input name="<?php ; something_else(); ?>" /> |
|
21 | +<input name="<?php; something_else(); ?>" /> |
|
22 | 22 | <input name="<?php something_else(); ; ?>" /> |
23 | 23 | |
24 | 24 | /* |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * Test detecting & fixing a combination of the two above checks. |
41 | 41 | */ |
42 | 42 | --> |
43 | -<?php ; ?> |
|
43 | +<?php; ?> |
|
44 | 44 | |
45 | -<input name="<?php ; ?>" /> <!-- Bad. --> |
|
45 | +<input name="<?php; ?>" /> <!-- Bad. --> |
|
46 | 46 | |
47 | 47 | <!-- Tests with short open echo tag. --> |
48 | 48 | <input name="<?= 'some text' ?>" /> <!-- OK. --> |
49 | 49 | <input name="<?= ?>" /> <!-- Bad. --> |
50 | -<input name="<?= ; ?>" /> <!-- Bad. --> |
|
50 | +<input name="<?=; ?>" /> <!-- Bad. --> |
|
51 | 51 | |
52 | 52 | <?php |
53 | 53 | // Guard against false positives for two consecutive semi-colons in a for statement. |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$a = array(1, 2, 3, 4); |
|
4 | -for ($i = 0; $i < count($a); $i++) { |
|
5 | - $a[$i] *= $i; |
|
3 | +$a = array( 1, 2, 3, 4 ); |
|
4 | +for ( $i = 0; $i < count( $a ); $i++ ) { |
|
5 | + $a[ $i ] *= $i; |
|
6 | 6 | } |
7 | 7 | |
8 | -for ($i = 0, $c = sizeof($a); $i < $c; ++$i) { |
|
9 | - $a[$i] *= $i; |
|
8 | +for ( $i = 0, $c = sizeof( $a ); $i < $c; ++$i ) { |
|
9 | + $a[ $i ] *= $i; |
|
10 | 10 | } |
11 | 11 | |
12 | -$it = new ArrayIterator($a); |
|
13 | -for ($it->rewind(); $it->valid(); $it->next()) { |
|
12 | +$it = new ArrayIterator( $a ); |
|
13 | +for ( $it->rewind(); $it->valid(); $it->next() ) { |
|
14 | 14 | echo $it->current(); |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | -for ($i = 0; $i < 10; $i++) { |
|
2 | +for ( $i = 0; $i < 10; $i++ ) { |
|
3 | 3 | // Everything is fine |
4 | 4 | } |
5 | 5 | |
6 | -for (; $it->valid();) { |
|
6 | +for ( ; $it->valid(); ) { |
|
7 | 7 | $it->next(); |
8 | 8 | } |
9 | 9 | |
10 | -for (;(($it1->valid() && $foo) || (!$it2->value && ($bar || false)));/*Could be ignored*/) { |
|
10 | +for ( ;( ( $it1->valid() && $foo ) || ( ! $it2->value && ( $bar || false ) ) ); /*Could be ignored*/ ) { |
|
11 | 11 | $it1->next(); |
12 | 12 | $it2->next(); |
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (true) { |
|
3 | +if ( true ) { |
|
4 | 4 | |
5 | -} else if (false) { |
|
5 | +} else if ( false ) { |
|
6 | 6 | |
7 | -} elseif (true) { |
|
7 | +} elseif ( true ) { |
|
8 | 8 | |
9 | 9 | } |
10 | 10 | |
11 | -if (file_exists(__FILE__) === true) { |
|
11 | +if ( file_exists( __FILE__ ) === true ) { |
|
12 | 12 | |
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -switch ($foo) { |
|
3 | +switch ( $foo ) { |
|
4 | 4 | // Empty switch statement body |
5 | 5 | } |
6 | 6 | |
7 | -switch ($foo) { |
|
7 | +switch ( $foo ) { |
|
8 | 8 | case 'bar': |
9 | 9 | break; |
10 | 10 | default: |
@@ -12,61 +12,61 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | |
15 | -if ($foo) { |
|
15 | +if ( $foo ) { |
|
16 | 16 | // Just a comment |
17 | -} elseif ($bar) { |
|
17 | +} elseif ( $bar ) { |
|
18 | 18 | // Yet another comment |
19 | 19 | } else { |
20 | 20 | |
21 | 21 | } |
22 | 22 | |
23 | -if ($foo) { |
|
23 | +if ( $foo ) { |
|
24 | 24 | $foo = 'bar'; |
25 | -} else if ($bar) { |
|
25 | +} else if ( $bar ) { |
|
26 | 26 | $bar = 'foo'; |
27 | 27 | } |
28 | 28 | |
29 | -for ($i = 0; $i < 10; $i++) { |
|
30 | - for ($j = 0; $j < 10; $j++) { |
|
29 | +for ( $i = 0; $i < 10; $i++ ) { |
|
30 | + for ( $j = 0; $j < 10; $j++ ) { |
|
31 | 31 | // Just a comment |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -foreach ($foo as $bar) {} |
|
35 | +foreach ( $foo as $bar ) {} |
|
36 | 36 | |
37 | -foreach ($foo as $bar) { |
|
37 | +foreach ( $foo as $bar ) { |
|
38 | 38 | $bar *= 2; |
39 | 39 | } |
40 | 40 | |
41 | 41 | do { |
42 | 42 | // Just a comment |
43 | 43 | // Just another comment |
44 | -} while ($foo); |
|
44 | +} while ( $foo ); |
|
45 | 45 | |
46 | 46 | do { |
47 | - while ($bar) { |
|
47 | + while ( $bar ) { |
|
48 | 48 | |
49 | 49 | } |
50 | -} while (true); |
|
50 | +} while ( true ); |
|
51 | 51 | |
52 | -while ($foo) { /* Comment in the same line */ } |
|
52 | +while ( $foo ) { /* Comment in the same line */ } |
|
53 | 53 | |
54 | -while ($foo) { |
|
54 | +while ( $foo ) { |
|
55 | 55 | try { |
56 | 56 | |
57 | - } catch (Exception $e) { |
|
57 | + } catch ( Exception $e ) { |
|
58 | 58 | echo $e->getTraceAsString(); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | 62 | try { |
63 | - throw Exception('Error...'); |
|
64 | -} catch (Exception $e) {} |
|
63 | + throw Exception( 'Error...' ); |
|
64 | +} catch ( Exception $e ) {} |
|
65 | 65 | |
66 | 66 | try { |
67 | - throw Exception('Error...'); |
|
68 | -} catch (Exception $e) { |
|
67 | + throw Exception( 'Error...' ); |
|
68 | +} catch ( Exception $e ) { |
|
69 | 69 | // TODO: Handle this exception later :-) |
70 | 70 | } |
71 | 71 | |
72 | -if (true) {} elseif (false) {} |
|
73 | 72 | \ No newline at end of file |
73 | +if ( true ) {} elseif ( false ) {} |
|
74 | 74 | \ No newline at end of file |