Index: trunk/tools/code-utils/stylize.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | } |
31 | 31 | |
32 | 32 | function stylize_recursivly( $dir ) { |
33 | | - foreach ( glob("$dir/*") as $dirOrFile ) { |
| 33 | + foreach ( glob( "$dir/*" ) as $dirOrFile ) { |
34 | 34 | if ( is_dir( $dirOrFile ) ) { // It's a directory, so call this function again. |
35 | 35 | stylize_recursivly( $dirOrFile ); |
36 | 36 | } elseif ( is_file( $dirOrFile ) ) { // It's a file, so let's stylize it. |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | stylize_file( $dirOrFile, false ); |
40 | 40 | } |
41 | 41 | } |
42 | | - } |
| 42 | + } |
43 | 43 | } |
44 | 44 | |
45 | 45 | function stylize_file( $filename, $backup = true ) { |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | static $tablesInitialised = false; |
71 | 71 | static $xSpaceBefore, $xSpaceAfter; |
72 | 72 | |
73 | | - static $space = array( |
| 73 | + static $space = array( |
74 | 74 | T_WHITESPACE, |
75 | 75 | 'START', |
76 | 76 | 'END', |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | '=', |
123 | 123 | '+', |
124 | 124 | '|', |
125 | | - //':', can be a case label |
| 125 | + // ':', can be a case label |
126 | 126 | '.', |
127 | 127 | '<', |
128 | 128 | '>', |
— | — | @@ -156,11 +156,11 @@ |
157 | 157 | $s = str_replace( "\r\n", "\n", $s ); |
158 | 158 | $this->tokens = token_get_all( $s ); |
159 | 159 | if ( !self::$tablesInitialised ) { |
160 | | - self::$xSpaceBefore = array_combine( |
| 160 | + self::$xSpaceBefore = array_combine( |
161 | 161 | array_merge( self::$spaceBefore, self::$spaceBothSides ), |
162 | 162 | array_fill( 0, count( self::$spaceBefore ) + count( self::$spaceBothSides ), true ) |
163 | 163 | ); |
164 | | - self::$xSpaceAfter = array_combine( |
| 164 | + self::$xSpaceAfter = array_combine( |
165 | 165 | array_merge( self::$spaceAfter, self::$spaceBothSides ), |
166 | 166 | array_fill( 0, count( self::$spaceAfter ) + count( self::$spaceBothSides ), true ) |
167 | 167 | ); |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | function get( $i ) { |
172 | 172 | if ( $i < 0 ) { |
173 | 173 | return array( 'START', '' ); |
174 | | - } elseif( $i >= count( $this->tokens ) ) { |
| 174 | + } elseif ( $i >= count( $this->tokens ) ) { |
175 | 175 | return array( 'END', '' ); |
176 | 176 | } else { |
177 | 177 | $token = $this->tokens[$i]; |
— | — | @@ -245,14 +245,14 @@ |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Detect close pairs like () |
249 | | - $closePairBefore = isset( self::$closePairs[$prevType] ) |
| 249 | + $closePairBefore = isset( self::$closePairs[$prevType] ) |
250 | 250 | && $curType == self::$closePairs[$prevType]; |
251 | | - $closePairAfter = isset( self::$closePairs[$curType] ) |
| 251 | + $closePairAfter = isset( self::$closePairs[$curType] ) |
252 | 252 | && $nextType == self::$closePairs[$curType]; |
253 | 253 | |
254 | 254 | // Add space before |
255 | | - if ( $this->isSpaceBefore( $curToken ) |
256 | | - && !$this->isSpace( $prevToken ) |
| 255 | + if ( $this->isSpaceBefore( $curToken ) |
| 256 | + && !$this->isSpace( $prevToken ) |
257 | 257 | && !$closePairBefore |
258 | 258 | ) { |
259 | 259 | $out .= ' '; |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | } |
276 | 276 | |
277 | 277 | // Add space after |
278 | | - if ( $wantSpaceAfter |
| 278 | + if ( $wantSpaceAfter |
279 | 279 | && !$closePairAfter |
280 | 280 | && !$this->isSpace( $nextToken ) |
281 | 281 | && !$this->isSpaceBefore( $nextToken ) |
Index: trunk/tools/code-utils/lint.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | $dir = '.'; |
18 | 18 | } |
19 | 19 | |
20 | | -if ( !check_dir( $dir ) ){ |
| 20 | +if ( !check_dir( $dir ) ) { |
21 | 21 | exit( 1 ); |
22 | 22 | } else { |
23 | 23 | exit( 0 ); |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | } |
36 | 36 | if ( is_dir( "$dir/$fileName" ) ) { |
37 | 37 | $ret = check_dir( "$dir/$fileName" ); |
38 | | - } elseif ( substr( $fileName, -4 ) == '.php' ) { |
| 38 | + } elseif ( substr( $fileName, - 4 ) == '.php' ) { |
39 | 39 | $ret = check_file( "$dir/$fileName" ); |
40 | 40 | } else { |
41 | 41 | $ret = true; |