Skip to content

Commit

Permalink
Merge branch 'feature/generic-functioncallargumentspacing-remove-equa…
Browse files Browse the repository at this point in the history
…l-sign-checks' of https://github.com/jrfnl/PHP_CodeSniffer into jrfnl-feature/generic-functioncallargumentspacing-remove-equal-sign-checks
  • Loading branch information
sertand committed May 23, 2019
2 parents 19de461 + feeda47 commit dcad0df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public function process(File $phpcsFile, $stackPtr)

$find = [
T_COMMA,
T_VARIABLE,
T_CLOSURE,
T_ANON_CLASS,
T_OPEN_SHORT_ARRAY,
Expand Down Expand Up @@ -157,28 +156,6 @@ public function process(File $phpcsFile, $stackPtr)
}
}
}//end if
} else {
// Token is a variable.
$nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextSeparator + 1), $closeBracket, true);
if ($nextToken !== false) {
if ($tokens[$nextToken]['code'] === T_EQUAL) {
if (($tokens[($nextToken - 1)]['code']) !== T_WHITESPACE) {
$error = 'Expected 1 space before = sign of default value';
$fix = $phpcsFile->addFixableError($error, $nextToken, 'NoSpaceBeforeEquals');
if ($fix === true) {
$phpcsFile->fixer->addContentBefore($nextToken, ' ');
}
}

if ($tokens[($nextToken + 1)]['code'] !== T_WHITESPACE) {
$error = 'Expected 1 space after = sign of default value';
$fix = $phpcsFile->addFixableError($error, $nextToken, 'NoSpaceAfterEquals');
if ($fix === true) {
$phpcsFile->fixer->addContent($nextToken, ' ');
}
}
}
}
}//end if
}//end while

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ $result = myFunction($arg1, $arg2);
$result = myFunction($arg1, $arg2, $arg3, $arg4, $arg5);
$result = myFunction($arg1, $arg2, $arg3, $arg4, $arg5);
$result = myFunction($arg1, $arg2 = array());
$result = myFunction($arg1, $arg2 = array());
$result = myFunction($arg1, $arg2 = array());
$result = myFunction($arg1, $arg2 = array());
$result = myFunction($arg1, $arg2 =array());
$result = myFunction($arg1, $arg2= array());
$result = myFunction($arg1, $arg2=array());

$result = myFunction($arg1,
$arg2 = array(),
Expand Down Expand Up @@ -147,5 +147,5 @@ $foobar = functionCallAnonClassParam(
$foo = array(1,2,3);
}
},
$args = array(),
$args=array(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public function getErrorList()
6 => 1,
7 => 2,
8 => 1,
11 => 2,
12 => 2,
13 => 3,
11 => 1,
12 => 1,
13 => 1,
42 => 3,
43 => 3,
45 => 1,
Expand All @@ -52,7 +52,6 @@ public function getErrorList()
132 => 2,
133 => 2,
134 => 1,
150 => 2,
];

}//end getErrorList()
Expand Down

0 comments on commit dcad0df

Please sign in to comment.