Skip to content

Commit

Permalink
Changelog + minor reverts for #2441 (ref #2411)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Apr 15, 2019
1 parent f1a8e47 commit 2d6b0f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 5 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- Added support for only checking files that have been locally staged in a git repo
-- Use --filter=gitstaged to check these files
-- You still need to give PHPCS a list of files or directories in which to apply the filter
-- Thanks to Juliette Reinders Folmer for the contribution
-- Use --filter=gitstaged to check these files
-- You still need to give PHPCS a list of files or directories in which to apply the filter
-- Thanks to Juliette Reinders Folmer for the contribution
- PSR2.ControlStructures.ControlStructureSpacing now allows whitespace after the opening parenthesis if followed by a comment
-- Thanks to Michał Bundyra for the patch
- Fixed bug #2478 : FunctionCommentThrowTag.WrongNumber when exception is thrown once but built conditionally
- Fixed bug #2479 : Generic.WhiteSpace.ScopeIndent error when using array destructuring with exact indent checking
</notes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function process(File $phpcsFile, $stackPtr)
$parenOpener = $tokens[$stackPtr]['parenthesis_opener'];
$parenCloser = $tokens[$stackPtr]['parenthesis_closer'];
$nextContent = $phpcsFile->findNext(T_WHITESPACE, ($parenOpener + 1), null, true);
if (false === in_array($tokens[$nextContent]['code'], Tokens::$commentTokens, true)) {
if (in_array($tokens[$nextContent]['code'], Tokens::$commentTokens, true) === false) {
$spaceAfterOpen = 0;
if ($tokens[($parenOpener + 1)]['code'] === T_WHITESPACE) {
if (strpos($tokens[($parenOpener + 1)]['content'], $phpcsFile->eolChar) !== false) {
Expand All @@ -102,12 +102,10 @@ public function process(File $phpcsFile, $stackPtr)
$padding = str_repeat(' ', $this->requiredSpacesAfterOpen);
if ($spaceAfterOpen === 0) {
$phpcsFile->fixer->addContent($parenOpener, $padding);
} else if ($spaceAfterOpen === 'newline') {
$phpcsFile->fixer->replaceToken(($parenOpener + 1), '');
} else {
if ($spaceAfterOpen === 'newline') {
$phpcsFile->fixer->replaceToken(($parenOpener + 1), '');
} else {
$phpcsFile->fixer->replaceToken(($parenOpener + 1), $padding);
}
$phpcsFile->fixer->replaceToken(($parenOpener + 1), $padding);
}
}
}
Expand Down

0 comments on commit 2d6b0f7

Please sign in to comment.