|
@@ 211-234 (lines=24) @@
|
| 208 |
|
} |
| 209 |
|
}//end if |
| 210 |
|
|
| 211 |
|
if ($tokens[($nextArrow + 1)]['code'] !== T_WHITESPACE) { |
| 212 |
|
$content = $tokens[($nextArrow + 1)]['content']; |
| 213 |
|
$error = 'Expected 1 space between double arrow and "%s"; 0 found'; |
| 214 |
|
$data = array($content); |
| 215 |
|
$fix = $phpcsFile->addFixableError($error, $nextArrow, 'NoSpaceAfterDoubleArrow', $data); |
| 216 |
|
if ($fix === true) { |
| 217 |
|
$phpcsFile->fixer->addContent($nextArrow, ' '); |
| 218 |
|
} |
| 219 |
|
} else { |
| 220 |
|
$spaceLength = $tokens[($nextArrow + 1)]['length']; |
| 221 |
|
if ($spaceLength !== 1) { |
| 222 |
|
$content = $tokens[($nextArrow + 2)]['content']; |
| 223 |
|
$error = 'Expected 1 space between double arrow and "%s"; %s found'; |
| 224 |
|
$data = array( |
| 225 |
|
$content, |
| 226 |
|
$spaceLength, |
| 227 |
|
); |
| 228 |
|
|
| 229 |
|
$fix = $phpcsFile->addFixableError($error, $nextArrow, 'SpaceAfterDoubleArrow', $data); |
| 230 |
|
if ($fix === true) { |
| 231 |
|
$phpcsFile->fixer->replaceToken(($nextArrow + 1), ' '); |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
|
}//end if |
| 235 |
|
}//end while |
| 236 |
|
|
| 237 |
|
if ($valueCount > 0) { |
|
@@ 258-281 (lines=24) @@
|
| 255 |
|
// We have a multiple value array that is inside a condition or |
| 256 |
|
// function. Check its spacing is correct. |
| 257 |
|
foreach ($commas as $comma) { |
| 258 |
|
if ($tokens[($comma + 1)]['code'] !== T_WHITESPACE) { |
| 259 |
|
$content = $tokens[($comma + 1)]['content']; |
| 260 |
|
$error = 'Expected 1 space between comma and "%s"; 0 found'; |
| 261 |
|
$data = array($content); |
| 262 |
|
$fix = $phpcsFile->addFixableError($error, $comma, 'NoSpaceAfterComma', $data); |
| 263 |
|
if ($fix === true) { |
| 264 |
|
$phpcsFile->fixer->addContent($comma, ' '); |
| 265 |
|
} |
| 266 |
|
} else { |
| 267 |
|
$spaceLength = $tokens[($comma + 1)]['length']; |
| 268 |
|
if ($spaceLength !== 1) { |
| 269 |
|
$content = $tokens[($comma + 2)]['content']; |
| 270 |
|
$error = 'Expected 1 space between comma and "%s"; %s found'; |
| 271 |
|
$data = array( |
| 272 |
|
$content, |
| 273 |
|
$spaceLength, |
| 274 |
|
); |
| 275 |
|
|
| 276 |
|
$fix = $phpcsFile->addFixableError($error, $comma, 'SpaceAfterComma', $data); |
| 277 |
|
if ($fix === true) { |
| 278 |
|
$phpcsFile->fixer->replaceToken(($comma + 1), ' '); |
| 279 |
|
} |
| 280 |
|
} |
| 281 |
|
}//end if |
| 282 |
|
|
| 283 |
|
if ($tokens[($comma - 1)]['code'] === T_WHITESPACE) { |
| 284 |
|
$content = $tokens[($comma - 2)]['content']; |