@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | $var = array(); |
3 | -$var = []; |
|
4 | -$var = array(1,2,3); |
|
5 | -$var = [1,2,3]; |
|
6 | -echo $var[1]; |
|
7 | -$foo = [$var[1],$var[2]]; |
|
3 | +$var = [ ]; |
|
4 | +$var = array( 1, 2, 3 ); |
|
5 | +$var = [ 1, 2, 3 ]; |
|
6 | +echo $var[ 1 ]; |
|
7 | +$foo = [ $var[ 1 ], $var[ 2 ] ]; |
|
8 | 8 | $foo = [ |
9 | 9 | 1, |
10 | 10 | 2, |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return array<int, int> |
27 | 27 | */ |
28 | - public function getErrorList($testFile='') |
|
28 | + public function getErrorList( $testFile = '' ) |
|
29 | 29 | { |
30 | - switch ($testFile) { |
|
30 | + switch ( $testFile ) { |
|
31 | 31 | case 'DisallowLongArraySyntaxUnitTest.1.inc': |
32 | 32 | return [ |
33 | 33 | 2 => 1, |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 9 => 1, |
44 | 44 | ]; |
45 | 45 | default: |
46 | - return []; |
|
46 | + return [ ]; |
|
47 | 47 | }//end switch |
48 | 48 | |
49 | 49 | }//end getErrorList() |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getWarningList() |
61 | 61 | { |
62 | - return []; |
|
62 | + return [ ]; |
|
63 | 63 | |
64 | 64 | }//end getWarningList() |
65 | 65 |
@@ -8,10 +8,4 @@ |
||
8 | 8 | { |
9 | 9 | $arr = array( |
10 | 10 | 'a' => 'a', |
11 | -<<<<<<< HEAD |
|
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
|
11 | +<< << <<< HEAD |
@@ -1,72 +1,72 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $result = myFunction(); |
4 | -$result = myFunction($arg1, $arg2); |
|
5 | -$result = myFunction($arg1,$arg2); |
|
6 | -$result = myFunction($arg1 , $arg2); |
|
7 | -$result = myFunction($arg1 , $arg2); |
|
8 | -$result = myFunction($arg1, $arg2, $arg3,$arg4, $arg5); |
|
9 | -$result = myFunction($arg1, $arg2, $arg3, $arg4, $arg5); |
|
10 | -$result = myFunction($arg1, $arg2 = array()); |
|
11 | -$result = myFunction($arg1 , $arg2 =array()); |
|
12 | -$result = myFunction($arg1 , $arg2= array()); |
|
13 | -$result = myFunction($arg1 , $arg2=array()); |
|
14 | - |
|
15 | -$result = myFunction($arg1, |
|
4 | +$result = myFunction( $arg1, $arg2 ); |
|
5 | +$result = myFunction( $arg1, $arg2 ); |
|
6 | +$result = myFunction( $arg1, $arg2 ); |
|
7 | +$result = myFunction( $arg1, $arg2 ); |
|
8 | +$result = myFunction( $arg1, $arg2, $arg3, $arg4, $arg5 ); |
|
9 | +$result = myFunction( $arg1, $arg2, $arg3, $arg4, $arg5 ); |
|
10 | +$result = myFunction( $arg1, $arg2 = array() ); |
|
11 | +$result = myFunction( $arg1, $arg2 = array() ); |
|
12 | +$result = myFunction( $arg1, $arg2 = array() ); |
|
13 | +$result = myFunction( $arg1, $arg2 = array() ); |
|
14 | + |
|
15 | +$result = myFunction( $arg1, |
|
16 | 16 | $arg2 = array(), |
17 | 17 | $arg3, |
18 | 18 | $arg4, |
19 | - $arg5); |
|
19 | + $arg5 ); |
|
20 | 20 | |
21 | -throw new Exception("This is some massive string for a message", |
|
22 | - $cause); |
|
21 | +throw new Exception( "This is some massive string for a message", |
|
22 | + $cause ); |
|
23 | 23 | |
24 | 24 | // Function definitions are ignored |
25 | -function myFunction($arg1,$arg2) |
|
25 | +function myFunction( $arg1, $arg2 ) |
|
26 | 26 | { |
27 | 27 | } |
28 | 28 | |
29 | -function myFunction ($arg1,$arg2) |
|
29 | +function myFunction( $arg1, $arg2 ) |
|
30 | 30 | { |
31 | 31 | } |
32 | 32 | |
33 | -function myFunction($arg1=1,$arg2=2) |
|
33 | +function myFunction( $arg1 = 1, $arg2 = 2 ) |
|
34 | 34 | { |
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | -function myFunction($arg1 = 1,$arg2 = 2) |
|
38 | +function myFunction( $arg1 = 1, $arg2 = 2 ) |
|
39 | 39 | { |
40 | 40 | } |
41 | 41 | |
42 | -$key = array_search($this->getArray($one, $two,$three),$this->arrayMap); |
|
43 | -$this->error($obj->getCode(),$obj->getMessage(),$obj->getFile(),$obj->getLine()); |
|
42 | +$key = array_search( $this->getArray( $one, $two, $three ), $this->arrayMap ); |
|
43 | +$this->error( $obj->getCode(), $obj->getMessage(), $obj->getFile(), $obj->getLine() ); |
|
44 | 44 | |
45 | -make_foo($string /*the string*/ , true /*test*/); |
|
46 | -make_foo($string/*the string*/ , /*test*/ true); |
|
47 | -make_foo($string /*the string*/, /*test*/ true); |
|
45 | +make_foo( $string /*the string*/, true /*test*/ ); |
|
46 | +make_foo( $string/*the string*/, /*test*/ true ); |
|
47 | +make_foo( $string /*the string*/, /*test*/ true ); |
|
48 | 48 | |
49 | 49 | class MyClass { |
50 | 50 | function myFunction() { |
51 | - blah($foo, "{{$config['host']}}", "{$config}", "hi there{}{}{{{}{}{}}"); |
|
51 | + blah( $foo, "{{$config[ 'host' ]}}", "{$config}", "hi there{}{}{{{}{}{}}" ); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Function definition, not function call, so should be ignored |
56 | -function &myFunction($arg1=1,$arg2=2) |
|
56 | +function &myFunction( $arg1 = 1, $arg2 = 2 ) |
|
57 | 57 | { |
58 | 58 | } |
59 | 59 | |
60 | 60 | return array_udiff( |
61 | 61 | $foo, |
62 | 62 | $bar, |
63 | - function($a, $b) { |
|
64 | - $foo='bar'; |
|
63 | + function( $a, $b ) { |
|
64 | + $foo = 'bar'; |
|
65 | 65 | return $foo; |
66 | 66 | } |
67 | 67 | ); |
68 | 68 | |
69 | -var_dump(<<<FOO |
|
69 | +var_dump( <<<FOO |
|
70 | 70 | foo |
71 | 71 | FOO |
72 | 72 | , |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | THEN |
85 | 85 | ); |
86 | 86 | |
87 | -if (in_array($arg1, ['foo','bar'])) {} |
|
88 | -if (in_array($arg1, array('foo','bar'))) {} |
|
87 | +if ( in_array( $arg1, [ 'foo', 'bar' ] ) ) {} |
|
88 | +if ( in_array( $arg1, array( 'foo', 'bar' ) ) ) {} |
|
89 | 89 | |
90 | 90 | $b = foo( |
91 | 91 | "1", // this is a comment |
92 | - "2", // this is a comment |
|
93 | - "3",// this is a comment |
|
92 | + "2", // this is a comment |
|
93 | + "3", // this is a comment |
|
94 | 94 | "4" |
95 | 95 | ); |
96 | 96 | |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | 'bar' |
103 | 103 | ); |
104 | 104 | |
105 | -unset($foo,$bar); |
|
105 | +unset( $foo, $bar ); |
|
106 | 106 | |
107 | -$closure($foo,$bar); |
|
108 | -$var = $closure() + $closure($foo,$bar) + self::$closure($foo,$bar); |
|
107 | +$closure( $foo, $bar ); |
|
108 | +$var = $closure() + $closure( $foo, $bar ) + self::$closure( $foo, $bar ); |
|
109 | 109 | |
110 | 110 | class Test |
111 | 111 | { |
112 | - public static function baz($foo, $bar) |
|
112 | + public static function baz( $foo, $bar ) |
|
113 | 113 | { |
114 | - $a = new self($foo,$bar); |
|
115 | - $b = new static($foo,$bar); |
|
114 | + $a = new self( $foo, $bar ); |
|
115 | + $b = new static( $foo, $bar ); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | -$obj->{$var}($foo,$bar); |
|
119 | +$obj->{$var}( $foo, $bar ); |
|
120 | 120 | |
121 | -(function ($a, $b) { |
|
122 | - return function ($c, $d) use ($a, $b) { |
|
121 | +( function( $a, $b ) { |
|
122 | + return function( $c, $d ) use ( $a, $b ) { |
|
123 | 123 | echo $a, $b, $c, $d; |
124 | 124 | }; |
125 | -})('a','b')('c','d'); |
|
125 | +})( 'a', 'b' )( 'c', 'd' ); |
|
126 | 126 | |
127 | 127 | my_function_call( |
128 | 128 | 'a' |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | |
142 | 142 | $foobar = functionCallAnonClassParam( |
143 | 143 | new class() { |
144 | - public $foo=1; |
|
145 | - public function methodName($param='foo',$paramTwo='bar') { |
|
146 | - $bar=false; |
|
147 | - $foo = array(1,2,3); |
|
144 | + public $foo = 1; |
|
145 | + public function methodName( $param = 'foo', $paramTwo = 'bar' ) { |
|
146 | + $bar = false; |
|
147 | + $foo = array( 1, 2, 3 ); |
|
148 | 148 | } |
149 | 149 | }, |
150 | - $args=array(), |
|
150 | + $args = array(), |
|
151 | 151 | ); |
@@ -1,39 +1,39 @@ |
||
1 | 1 | <?php |
2 | 2 | class myclass extends yourclass implements someint { |
3 | - function myfunc($var) { |
|
3 | + function myfunc( $var ) { |
|
4 | 4 | echo $var; |
5 | 5 | } |
6 | 6 | } |
7 | 7 | |
8 | 8 | $myvar = true; |
9 | -myfunc(&$myvar); |
|
10 | -myfunc($myvar); |
|
9 | +myfunc( &$myvar ); |
|
10 | +myfunc( $myvar ); |
|
11 | 11 | |
12 | -$this->myfunc(&$myvar); |
|
13 | -$this->myfunc($myvar); |
|
12 | +$this->myfunc( &$myvar ); |
|
13 | +$this->myfunc( $myvar ); |
|
14 | 14 | |
15 | -myclass::myfunc(&$myvar); |
|
16 | -myclass::myfunc($myvar); |
|
15 | +myclass::myfunc( &$myvar ); |
|
16 | +myclass::myfunc( $myvar ); |
|
17 | 17 | |
18 | -while(testfunc($var1, &$var2, $var3, &$var4) === false) { |
|
18 | +while ( testfunc( $var1, &$var2, $var3, &$var4 ) === false ) { |
|
19 | 19 | } |
20 | 20 | |
21 | -sprintf("0%o", 0777 & $p); |
|
21 | +sprintf( "0%o", 0777 & $p ); |
|
22 | 22 | |
23 | -$foo(&$myvar); |
|
23 | +$foo( &$myvar ); |
|
24 | 24 | |
25 | -if (is_array($foo = &$this->bar())) { |
|
25 | +if ( is_array( $foo = &$this->bar() ) ) { |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | Hooks::run( 'SecondaryDataUpdates', [ $title, $old, $recursive, $parserOutput, &$updates ] ); |
29 | 29 | |
30 | -$foo = Bar(&$fooBar); |
|
30 | +$foo = Bar( &$fooBar ); |
|
31 | 31 | |
32 | -myfunc($myvar&$myvar); |
|
33 | -myfunc($myvar[0]&$myvar); |
|
32 | +myfunc( $myvar & $myvar ); |
|
33 | +myfunc( $myvar[ 0 ] & $myvar ); |
|
34 | 34 | |
35 | -myfunc(myclass::MY_CONST&$myvar); |
|
36 | -myfunc(MY_CONST&$myvar); |
|
35 | +myfunc( myclass::MY_CONST&$myvar ); |
|
36 | +myfunc( MY_CONST&$myvar ); |
|
37 | 37 | |
38 | 38 | efg( true == &$b ); |
39 | 39 | efg( true === &$b ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | // Too many spaces. |
13 | -function myFunction() { |
|
13 | +function myFunction() { |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | // Too many newlines. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | // Too many spaces. |
44 | - function myFunction() { |
|
44 | + function myFunction() { |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Too many newlines. |
@@ -63,68 +63,68 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | // Brace should be on new line. |
66 | -function myFunction($variable1, $variable2, |
|
67 | - $variable3, $variable4) { |
|
66 | +function myFunction( $variable1, $variable2, |
|
67 | + $variable3, $variable4 ) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Good. |
71 | -function myFunction($variable1, $variable2, |
|
72 | - $variable3, $variable4) |
|
71 | +function myFunction( $variable1, $variable2, |
|
72 | + $variable3, $variable4 ) |
|
73 | 73 | { |
74 | 74 | } |
75 | 75 | |
76 | 76 | // Too many spaces. |
77 | -function myFunction($variable1, $variable2, |
|
78 | - $variable3, $variable4) { |
|
77 | +function myFunction( $variable1, $variable2, |
|
78 | + $variable3, $variable4 ) { |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // Too many newlines. |
82 | -function myFunction($variable1, $variable2, |
|
83 | - $variable3, $variable4) |
|
82 | +function myFunction( $variable1, $variable2, |
|
83 | + $variable3, $variable4 ) |
|
84 | 84 | |
85 | 85 | { |
86 | 86 | } |
87 | 87 | |
88 | 88 | // Space before brace. |
89 | -function myFunction($variable1, $variable2, |
|
90 | - $variable3, $variable4) |
|
89 | +function myFunction( $variable1, $variable2, |
|
90 | + $variable3, $variable4 ) |
|
91 | 91 | { |
92 | 92 | } |
93 | 93 | |
94 | 94 | class myClass |
95 | 95 | { |
96 | 96 | // Brace should be on new line. |
97 | - function myFunction($variable1, $variable2, |
|
98 | - $variable3, $variable4) { |
|
97 | + function myFunction( $variable1, $variable2, |
|
98 | + $variable3, $variable4 ) { |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Good. |
102 | - function myFunction($variable1, $variable2, |
|
103 | - $variable3, $variable4) |
|
102 | + function myFunction( $variable1, $variable2, |
|
103 | + $variable3, $variable4 ) |
|
104 | 104 | { |
105 | 105 | } |
106 | 106 | |
107 | 107 | // No aligned correctly. |
108 | - function myFunction($variable1, $variable2, |
|
109 | - $variable3, $variable4) |
|
108 | + function myFunction( $variable1, $variable2, |
|
109 | + $variable3, $variable4 ) |
|
110 | 110 | { |
111 | 111 | } |
112 | 112 | |
113 | 113 | // Too many spaces. |
114 | - function myFunction($variable1, $variable2, |
|
115 | - $variable3, $variable4) { |
|
114 | + function myFunction( $variable1, $variable2, |
|
115 | + $variable3, $variable4 ) { |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Too many newlines. |
119 | - function myFunction($variable1, $variable2, |
|
120 | - $variable3, $variable4) |
|
119 | + function myFunction( $variable1, $variable2, |
|
120 | + $variable3, $variable4 ) |
|
121 | 121 | |
122 | 122 | { |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Space before brace. |
126 | - function myFunction($variable1, $variable2, |
|
127 | - $variable3, $variable4) |
|
126 | + function myFunction( $variable1, $variable2, |
|
127 | + $variable3, $variable4 ) |
|
128 | 128 | { |
129 | 129 | } |
130 | 130 | } |
@@ -161,25 +161,25 @@ discard block |
||
161 | 161 | |
162 | 162 | // phpcs:set Generic.Functions.OpeningFunctionBraceBsdAllman checkClosures 1 |
163 | 163 | |
164 | -$closureWithArgs = function ($arg1, $arg2) { |
|
164 | +$closureWithArgs = function( $arg1, $arg2 ) { |
|
165 | 165 | // body |
166 | 166 | }; |
167 | 167 | |
168 | -$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) { |
|
168 | +$closureWithArgsAndVars = function( $arg1, $arg2 ) use ( $var1, $var2 ) { |
|
169 | 169 | // body |
170 | 170 | }; |
171 | 171 | |
172 | -$test = function ($param) use ($result) { |
|
172 | +$test = function( $param ) use ( $result ) { |
|
173 | 173 | return null; |
174 | 174 | }; |
175 | 175 | |
176 | -$test = function ($param) use ($result) : Something { |
|
176 | +$test = function( $param ) use ( $result ) : Something { |
|
177 | 177 | return null; |
178 | 178 | }; |
179 | 179 | |
180 | 180 | // phpcs:set Generic.Functions.OpeningFunctionBraceBsdAllman checkClosures 0 |
181 | 181 | |
182 | -$closureWithArgs = function ($arg1, $arg2) { |
|
182 | +$closureWithArgs = function( $arg1, $arg2 ) { |
|
183 | 183 | // body |
184 | 184 | }; |
185 | 185 | |
@@ -197,42 +197,42 @@ discard block |
||
197 | 197 | return null; |
198 | 198 | } |
199 | 199 | |
200 | -function myFunction($a, $lot, $of, $params) |
|
200 | +function myFunction( $a, $lot, $of, $params ) |
|
201 | 201 | : array { |
202 | 202 | return null; |
203 | 203 | } |
204 | 204 | |
205 | -function myFunction($a, $lot, $of, $params) { // comment |
|
205 | +function myFunction( $a, $lot, $of, $params ) { // comment |
|
206 | 206 | return null; |
207 | 207 | } |
208 | 208 | |
209 | -function myFunction($a, $lot, $of, $params) |
|
209 | +function myFunction( $a, $lot, $of, $params ) |
|
210 | 210 | : array { // comment |
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | |
214 | -function myFunction($a, $lot, $of, $params) |
|
214 | +function myFunction( $a, $lot, $of, $params ) |
|
215 | 215 | : array { // phpcs:ignore Standard.Category.Sniff -- for reasons. |
216 | 216 | return null; |
217 | 217 | } |
218 | 218 | |
219 | -function myFunction($a, $lot, $of, $params) |
|
219 | +function myFunction( $a, $lot, $of, $params ) |
|
220 | 220 | : array {// phpcs:ignore Standard.Category.Sniff -- for reasons. |
221 | 221 | return null; |
222 | 222 | } |
223 | 223 | |
224 | -function myFunction($a, $lot, $of, $params) |
|
224 | +function myFunction( $a, $lot, $of, $params ) |
|
225 | 225 | : array |
226 | 226 | { // phpcs:ignore Standard.Category.Sniff -- for reasons. |
227 | 227 | return null; |
228 | 228 | } |
229 | 229 | |
230 | -function myFunction($a, $lot, $of, $params) |
|
230 | +function myFunction( $a, $lot, $of, $params ) |
|
231 | 231 | : array /* phpcs:ignore Standard.Category.Sniff -- for reasons */ { |
232 | 232 | return null; |
233 | 233 | } |
234 | 234 | |
235 | -function myFunction($a, $lot, $of, $params) |
|
235 | +function myFunction( $a, $lot, $of, $params ) |
|
236 | 236 | : array /* comment */ { |
237 | 237 | return null; |
238 | 238 | } |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | // Too many spaces. |
13 | -function myFunction() { |
|
13 | +function myFunction() { |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | // Uses tab. |
17 | -function myFunction() { |
|
17 | +function myFunction() { |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | // Too many spaces. |
33 | - function myFunction() { |
|
33 | + function myFunction() { |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Uses tab. |
37 | - function myFunction() { |
|
37 | + function myFunction() { |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -43,48 +43,48 @@ discard block |
||
43 | 43 | /* Multi-line declarations */ |
44 | 44 | |
45 | 45 | // Good. |
46 | -function myFunction($variable1, $variable2, |
|
47 | - $variable3, $variable4) { |
|
46 | +function myFunction( $variable1, $variable2, |
|
47 | + $variable3, $variable4 ) { |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Brace should be on same line. |
51 | -function myFunction($variable1, $variable2, |
|
52 | - $variable3, $variable4) |
|
51 | +function myFunction( $variable1, $variable2, |
|
52 | + $variable3, $variable4 ) |
|
53 | 53 | { |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Too many spaces. |
57 | -function myFunction($variable1, $variable2, |
|
58 | - $variable3, $variable4) { |
|
57 | +function myFunction( $variable1, $variable2, |
|
58 | + $variable3, $variable4 ) { |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Uses tab. |
62 | -function myFunction($variable1, $variable2, |
|
63 | - $variable3, $variable4) { |
|
62 | +function myFunction( $variable1, $variable2, |
|
63 | + $variable3, $variable4 ) { |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | 67 | class myClass |
68 | 68 | { |
69 | 69 | // Good. |
70 | - function myFunction($variable1, $variable2, |
|
71 | - $variable3, $variable4) { |
|
70 | + function myFunction( $variable1, $variable2, |
|
71 | + $variable3, $variable4 ) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // Brace should be on same line. |
75 | - function myFunction($variable1, $variable2, |
|
76 | - $variable3, $variable4) |
|
75 | + function myFunction( $variable1, $variable2, |
|
76 | + $variable3, $variable4 ) |
|
77 | 77 | { |
78 | 78 | } |
79 | 79 | |
80 | 80 | // Too many spaces. |
81 | - function myFunction($variable1, $variable2, |
|
82 | - $variable3, $variable4) { |
|
81 | + function myFunction( $variable1, $variable2, |
|
82 | + $variable3, $variable4 ) { |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Uses tab. |
86 | - function myFunction($variable1, $variable2, |
|
87 | - $variable3, $variable4) { |
|
86 | + function myFunction( $variable1, $variable2, |
|
87 | + $variable3, $variable4 ) { |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -120,36 +120,36 @@ discard block |
||
120 | 120 | |
121 | 121 | // phpcs:set Generic.Functions.OpeningFunctionBraceKernighanRitchie checkClosures 1 |
122 | 122 | |
123 | -$closureWithArgs = function ($arg1, $arg2){ |
|
123 | +$closureWithArgs = function( $arg1, $arg2 ) { |
|
124 | 124 | // body |
125 | 125 | }; |
126 | 126 | |
127 | -$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2){ |
|
127 | +$closureWithArgsAndVars = function( $arg1, $arg2 ) use ( $var1, $var2 ){ |
|
128 | 128 | // body |
129 | 129 | }; |
130 | 130 | |
131 | -$test = function ($param) use ($result) |
|
131 | +$test = function( $param ) use ( $result ) |
|
132 | 132 | { |
133 | 133 | return null; |
134 | 134 | }; |
135 | 135 | |
136 | -$test = function ($param) use ($result) : Something |
|
136 | +$test = function( $param ) use ( $result ) : Something |
|
137 | 137 | { |
138 | 138 | return null; |
139 | 139 | }; |
140 | 140 | |
141 | -$test = function ($param) use ($result): Something |
|
141 | +$test = function( $param ) use ( $result ): Something |
|
142 | 142 | { |
143 | 143 | return null; |
144 | 144 | }; |
145 | 145 | |
146 | -foo(function ($bar) { ?> |
|
146 | +foo( function( $bar ) { ?> |
|
147 | 147 | <div><?php echo $bar; ?></div> |
148 | 148 | <?php }); |
149 | 149 | |
150 | 150 | // phpcs:set Generic.Functions.OpeningFunctionBraceKernighanRitchie checkClosures 0 |
151 | 151 | |
152 | -$closureWithArgs = function ($arg1, $arg2){ |
|
152 | +$closureWithArgs = function( $arg1, $arg2 ) { |
|
153 | 153 | // body |
154 | 154 | }; |
155 | 155 | |
@@ -172,39 +172,39 @@ discard block |
||
172 | 172 | return null; |
173 | 173 | } |
174 | 174 | |
175 | -function myFunction($bar) { ?> |
|
175 | +function myFunction( $bar ) { ?> |
|
176 | 176 | <div><?php echo $bar; ?></div> |
177 | 177 | <?php } |
178 | 178 | |
179 | -function myFunction($a, $lot, $of, $params) |
|
179 | +function myFunction( $a, $lot, $of, $params ) |
|
180 | 180 | : array |
181 | 181 | { |
182 | 182 | return null; |
183 | 183 | } |
184 | 184 | |
185 | -function myFunction($a, $lot, $of, $params) |
|
185 | +function myFunction( $a, $lot, $of, $params ) |
|
186 | 186 | : array { |
187 | 187 | return null; |
188 | 188 | } |
189 | 189 | |
190 | -function myFunction($a, $lot, $of, $params) // comment |
|
190 | +function myFunction( $a, $lot, $of, $params ) // comment |
|
191 | 191 | { |
192 | 192 | return null; |
193 | 193 | } |
194 | 194 | |
195 | -function myFunction($a, $lot, $of, $params) |
|
195 | +function myFunction( $a, $lot, $of, $params ) |
|
196 | 196 | : array // comment |
197 | 197 | { |
198 | 198 | return null; |
199 | 199 | } |
200 | 200 | |
201 | -function myFunction($a, $lot, $of, $params) |
|
201 | +function myFunction( $a, $lot, $of, $params ) |
|
202 | 202 | : array // phpcs:ignore Standard.Category.Sniff -- for reasons. |
203 | 203 | { |
204 | 204 | return null; |
205 | 205 | } |
206 | 206 | |
207 | -function myFunction($a, $lot, $of, $params) |
|
207 | +function myFunction( $a, $lot, $of, $params ) |
|
208 | 208 | : array { // phpcs:ignore Standard.Category.Sniff -- for reasons. |
209 | 209 | return null; |
210 | 210 | } |
@@ -52,60 +52,60 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function process(File $phpcsFile, $stackPtr) |
|
55 | + public function process( File $phpcsFile, $stackPtr ) |
|
56 | 56 | { |
57 | 57 | $tokens = $phpcsFile->getTokens(); |
58 | - $this->spacing = (int) $this->spacing; |
|
58 | + $this->spacing = (int)$this->spacing; |
|
59 | 59 | |
60 | - if ($tokens[$stackPtr]['code'] === T_BINARY_CAST |
|
61 | - && $tokens[$stackPtr]['content'] === 'b' |
|
60 | + if ( $tokens[ $stackPtr ][ 'code' ] === T_BINARY_CAST |
|
61 | + && $tokens[ $stackPtr ][ 'content' ] === 'b' |
|
62 | 62 | ) { |
63 | 63 | // You can't replace a space after this type of binary casting. |
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); |
|
68 | - if ($nextNonEmpty === false) { |
|
67 | + $nextNonEmpty = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true ); |
|
68 | + if ( $nextNonEmpty === false ) { |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | - if ($this->ignoreNewlines === true |
|
73 | - && $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line'] |
|
72 | + if ( $this->ignoreNewlines === true |
|
73 | + && $tokens[ $stackPtr ][ 'line' ] !== $tokens[ $nextNonEmpty ][ 'line' ] |
|
74 | 74 | ) { |
75 | - $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 'newline'); |
|
75 | + $phpcsFile->recordMetric( $stackPtr, 'Spacing after cast statement', 'newline' ); |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | - if ($this->spacing === 0 && $nextNonEmpty === ($stackPtr + 1)) { |
|
80 | - $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0); |
|
79 | + if ( $this->spacing === 0 && $nextNonEmpty === ( $stackPtr + 1 ) ) { |
|
80 | + $phpcsFile->recordMetric( $stackPtr, 'Spacing after cast statement', 0 ); |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
84 | - $nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); |
|
85 | - if ($nextNonEmpty !== $nextNonWhitespace) { |
|
84 | + $nextNonWhitespace = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true ); |
|
85 | + if ( $nextNonEmpty !== $nextNonWhitespace ) { |
|
86 | 86 | $error = 'Expected %s space(s) after cast statement; comment found'; |
87 | - $data = [$this->spacing]; |
|
88 | - $phpcsFile->addError($error, $stackPtr, 'CommentFound', $data); |
|
87 | + $data = [ $this->spacing ]; |
|
88 | + $phpcsFile->addError( $error, $stackPtr, 'CommentFound', $data ); |
|
89 | 89 | |
90 | - if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { |
|
91 | - $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $tokens[($stackPtr + 1)]['length']); |
|
90 | + if ( $tokens[ ( $stackPtr + 1 ) ][ 'code' ] === T_WHITESPACE ) { |
|
91 | + $phpcsFile->recordMetric( $stackPtr, 'Spacing after cast statement', $tokens[ ( $stackPtr + 1 ) ][ 'length' ] ); |
|
92 | 92 | } else { |
93 | - $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0); |
|
93 | + $phpcsFile->recordMetric( $stackPtr, 'Spacing after cast statement', 0 ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return; |
97 | 97 | } |
98 | 98 | |
99 | 99 | $found = 0; |
100 | - if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) { |
|
100 | + if ( $tokens[ $stackPtr ][ 'line' ] !== $tokens[ $nextNonEmpty ][ 'line' ] ) { |
|
101 | 101 | $found = 'newline'; |
102 | - } else if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { |
|
103 | - $found = $tokens[($stackPtr + 1)]['length']; |
|
102 | + } else if ( $tokens[ ( $stackPtr + 1 ) ][ 'code' ] === T_WHITESPACE ) { |
|
103 | + $found = $tokens[ ( $stackPtr + 1 ) ][ 'length' ]; |
|
104 | 104 | } |
105 | 105 | |
106 | - $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $found); |
|
106 | + $phpcsFile->recordMetric( $stackPtr, 'Spacing after cast statement', $found ); |
|
107 | 107 | |
108 | - if ($found === $this->spacing) { |
|
108 | + if ( $found === $this->spacing ) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
@@ -116,31 +116,31 @@ discard block |
||
116 | 116 | ]; |
117 | 117 | |
118 | 118 | $errorCode = 'TooMuchSpace'; |
119 | - if ($this->spacing !== 0) { |
|
120 | - if ($found === 0) { |
|
119 | + if ( $this->spacing !== 0 ) { |
|
120 | + if ( $found === 0 ) { |
|
121 | 121 | $errorCode = 'NoSpace'; |
122 | - } else if ($found !== 'newline' && $found < $this->spacing) { |
|
122 | + } else if ( $found !== 'newline' && $found < $this->spacing ) { |
|
123 | 123 | $errorCode = 'TooLittleSpace'; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data); |
|
127 | + $fix = $phpcsFile->addFixableError( $error, $stackPtr, $errorCode, $data ); |
|
128 | 128 | |
129 | - if ($fix === true) { |
|
130 | - $padding = str_repeat(' ', $this->spacing); |
|
131 | - if ($found === 0) { |
|
132 | - $phpcsFile->fixer->addContent($stackPtr, $padding); |
|
129 | + if ( $fix === true ) { |
|
130 | + $padding = str_repeat( ' ', $this->spacing ); |
|
131 | + if ( $found === 0 ) { |
|
132 | + $phpcsFile->fixer->addContent( $stackPtr, $padding ); |
|
133 | 133 | } else { |
134 | 134 | $phpcsFile->fixer->beginChangeset(); |
135 | - $start = ($stackPtr + 1); |
|
135 | + $start = ( $stackPtr + 1 ); |
|
136 | 136 | |
137 | - if ($this->spacing > 0) { |
|
138 | - $phpcsFile->fixer->replaceToken($start, $padding); |
|
137 | + if ( $this->spacing > 0 ) { |
|
138 | + $phpcsFile->fixer->replaceToken( $start, $padding ); |
|
139 | 139 | ++$start; |
140 | 140 | } |
141 | 141 | |
142 | - for ($i = $start; $i < $nextNonWhitespace; $i++) { |
|
143 | - $phpcsFile->fixer->replaceToken($i, ''); |
|
142 | + for ( $i = $start; $i < $nextNonWhitespace; $i++ ) { |
|
143 | + $phpcsFile->fixer->replaceToken( $i, '' ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $phpcsFile->fixer->endChangeset(); |
@@ -41,18 +41,18 @@ |
||
41 | 41 | * |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - public function process(File $phpcsFile, $stackPtr) |
|
44 | + public function process( File $phpcsFile, $stackPtr ) |
|
45 | 45 | { |
46 | 46 | $tokens = $phpcsFile->getTokens(); |
47 | 47 | |
48 | - if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) { |
|
48 | + if ( $tokens[ ( $stackPtr + 1 ) ][ 'code' ] !== T_WHITESPACE ) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $error = 'A cast statement must not be followed by a space'; |
53 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceFound'); |
|
54 | - if ($fix === true) { |
|
55 | - $phpcsFile->fixer->replaceToken(($stackPtr + 1), ''); |
|
53 | + $fix = $phpcsFile->addFixableError( $error, $stackPtr, 'SpaceFound' ); |
|
54 | + if ( $fix === true ) { |
|
55 | + $phpcsFile->fixer->replaceToken( ( $stackPtr + 1 ), '' ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | }//end process() |