|
10 | 10 | namespace PHP_CodeSniffer\Standards\PEAR\Sniffs\Functions;
|
11 | 11 |
|
12 | 12 | use PHP_CodeSniffer\Files\File;
|
| 13 | +use PHP_CodeSniffer\Ruleset; |
13 | 14 | use PHP_CodeSniffer\Sniffs\Sniff;
|
14 | 15 | use PHP_CodeSniffer\Util\Tokens;
|
15 | 16 |
|
@@ -40,6 +41,13 @@ class FunctionCallSignatureSniff implements Sniff
|
40 | 41 | */
|
41 | 42 | public $allowMultipleArguments = true;
|
42 | 43 |
|
| 44 | + /** |
| 45 | + * If TRUE, we are running at the same time as a conflicting sniff |
| 46 | + * |
| 47 | + * @var boolean |
| 48 | + */ |
| 49 | + private bool $isConflictWithGenericWhitespace; |
| 50 | + |
43 | 51 | /**
|
44 | 52 | * How many spaces should follow the opening bracket.
|
45 | 53 | *
|
@@ -539,10 +547,21 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
|
539 | 547 | $foundIndent = $tokens[$i]['length'];
|
540 | 548 | }
|
541 | 549 |
|
| 550 | + if (!isset($this->isConflictWithGenericWhitespace)) { |
| 551 | + $this->isConflictWithGenericWhitespace = false; |
| 552 | + $ruleset = new Ruleset($phpcsFile->config); |
| 553 | + foreach ($ruleset->sniffCodes as $sniff) { |
| 554 | + if ($sniff === \PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ScopeIndentSniff::class) { |
| 555 | + $this->isConflictWithGenericWhitespace = true; |
| 556 | + break; |
| 557 | + } |
| 558 | + } |
| 559 | + } |
| 560 | + |
542 | 561 | if (($foundIndent < $expectedIndent
|
543 | 562 | || ($inArg === false
|
544 | 563 | && $expectedIndent !== $foundIndent))
|
545 |
| - && in_array('Generic.WhiteSpace.ScopeIndent', $phpcsFile->config->sniffs, true) === false |
| 564 | + && $this->isConflictWithGenericWhitespace === false |
546 | 565 | ) {
|
547 | 566 | $error = 'Multi-line function call not indented correctly; expected %s spaces but found %s';
|
548 | 567 | $data = [
|
|
0 commit comments