diff --git a/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc b/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc
index 55d1a06ab8..ac82c6814e 100644
--- a/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc
+++ b/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc
@@ -26,3 +26,18 @@ if ($foo) {
$this->foo()
->bar()
->baz();
+
+// https://github.com/squizlabs/PHP_CodeSniffer/issues/2078#issuecomment-401641650
+// See also PSR2.Methods.FunctionCallSignature
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
diff --git a/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc.fixed b/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc.fixed
index e9ae5ff392..f8d242d217 100644
--- a/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc.fixed
+++ b/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc.fixed
@@ -26,3 +26,18 @@ if ($foo) {
$this->foo()
->bar()
->baz();
+
+// https://github.com/squizlabs/PHP_CodeSniffer/issues/2078#issuecomment-401641650
+// See also PSR2.Methods.FunctionCallSignature
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
diff --git a/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php b/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php
index 2533b434c0..b3e5ee8708 100644
--- a/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php
+++ b/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php
@@ -84,6 +84,9 @@ public function getErrorList($testFile='')
6 => 1,
7 => 1,
10 => 1,
+ 40 => 1,
+ 41 => 1,
+ 42 => 1,
];
}
diff --git a/src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php b/src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
index 772ab6b8c0..1adec7b81d 100644
--- a/src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
+++ b/src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
@@ -339,7 +339,7 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
// We need to work out how far indented the function
// call itself is, so we can work out how far to
// indent the arguments.
- $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $stackPtr, true);
+ $first = $phpcsFile->findFirstOnLine([T_WHITESPACE, T_INLINE_HTML], $stackPtr, true);
if ($first !== false
&& $tokens[$first]['code'] === T_CONSTANT_ENCAPSED_STRING
&& $tokens[($first - 1)]['code'] === T_CONSTANT_ENCAPSED_STRING
@@ -376,30 +376,16 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
// at a tab stop. Without this, the function will be indented a further
// $indent spaces to the right.
$functionIndent = (int) (floor($foundFunctionIndent / $this->indent) * $this->indent);
- $adjustment = 0;
+ $adjustment = ($functionIndent - $foundFunctionIndent);
if ($foundFunctionIndent !== $functionIndent) {
- $error = 'Opening statement of multi-line function call not indented correctly; expected %s spaces but found %s';
- $data = [
+ $this->complainOpenStatementWrongIndent(
+ $phpcsFile,
+ $first,
+ $tokens,
$functionIndent,
- $foundFunctionIndent,
- ];
-
- $fix = $phpcsFile->addFixableError($error, $first, 'OpeningIndent', $data);
- if ($fix === true) {
- // Set adjustment for use later to determine whether argument indentation is correct when fixing.
- $adjustment = ($functionIndent - $foundFunctionIndent);
-
- $padding = str_repeat(' ', $functionIndent);
- if ($foundFunctionIndent === 0) {
- $phpcsFile->fixer->addContentBefore($first, $padding);
- } else if ($tokens[$first]['code'] === T_INLINE_HTML) {
- $newContent = $padding.ltrim($tokens[$first]['content']);
- $phpcsFile->fixer->replaceToken($first, $newContent);
- } else {
- $phpcsFile->fixer->replaceToken(($first - 1), $padding);
- }
- }
+ $foundFunctionIndent
+ );
}//end if
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($openBracket + 1), null, true);
@@ -465,7 +451,7 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
$i--;
}
- for ($i; $i < $closeBracket; $i++) {
+ for (; $i < $closeBracket; $i++) {
if ($i > $argStart && $i < $argEnd) {
$inArg = true;
} else {
@@ -530,25 +516,52 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
if ($tokens[$i]['code'] === T_COMMENT
&& $tokens[($i - 1)]['code'] === T_COMMENT
) {
- $trimmedLength = strlen(ltrim($tokens[$i]['content']));
+ $content = $tokens[$i]['content'];
+ $trimmedLength = strlen(ltrim($content));
if ($trimmedLength === 0) {
// This is a blank comment line, so indenting it is
// pointless.
continue;
}
- $foundIndent = (strlen($tokens[$i]['content']) - $trimmedLength);
+ $content = str_replace("\t", str_repeat(' ', $this->indent), $content);
+ $foundIndent = (strlen($content) - $trimmedLength ) ;
} else {
$foundIndent = 0;
}
} else {
- $foundIndent = $tokens[$i]['length'];
- }
+ $content = str_replace("\t", str_repeat(' ', $this->indent), $tokens[$i]['content']);
+ $foundIndent = strlen($content);
+ }//end if
- if ($foundIndent < $expectedIndent
- || ($inArg === false
- && $expectedIndent !== $foundIndent)
- ) {
+ $indentCorrect = true;
+
+ if ($foundIndent < $expectedIndent) {
+ $indentCorrect = false;
+ } else if ($inArg === false && $expectedIndent !== $foundIndent) {
+ $indentCorrect = false;
+
+ // It is permitted to indent chains further than one tab stop to
+ // align vertically with the previous method call.
+ if ($i === ($closeBracket - 1)) {
+ if ($foundIndent === $foundFunctionIndent) {
+ // This is the closing paren; it lines up vertically with the opening paren.
+ $indentCorrect = true;
+ }
+ } else {
+ if ($foundIndent === ($tokens[$openBracket]['column'] - 1)) {
+ // This is a parameter; it lines up vertically with the opening paren.
+ $indentCorrect = true;
+ }
+
+ if ($foundIndent === ($foundFunctionIndent + ($this->indent))) {
+ // This is a parameter; it is indented one more step than the function call around it.
+ $indentCorrect = true;
+ }
+ }
+ }//end if
+
+ if ($indentCorrect === false) {
$error = 'Multi-line function call not indented correctly; expected %s spaces but found %s';
$data = [
$expectedIndent,
@@ -631,4 +644,59 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
}//end processMultiLineCall()
+ /**
+ * Add a complaint (and auto-fix) if the function indent is 'wrong'.
+ *
+ * @param File $phpcsFile The file being scanned.
+ * @param int $first Pointer to the first empty token on this line.
+ * @param array $tokens The stack of tokens that make up the file.
+ * @param int $functionIndent The expected indent for this function definition.
+ * @param int $foundFunctionIndent The actual indent for this function definition.
+ *
+ * @return void
+ */
+ protected function complainOpenStatementWrongIndent(
+ $phpcsFile,
+ $first,
+ $tokens,
+ $functionIndent,
+ $foundFunctionIndent
+ ) {
+ if ($foundFunctionIndent === $functionIndent) {
+ return;
+ }
+
+ $firstToken = $tokens[$first];
+ if ($firstToken['code'] === T_OPEN_TAG || $firstToken['code'] === T_OPEN_TAG_WITH_ECHO) {
+ $prevToken = $tokens[($first - 1)];
+ if ($prevToken !== false && $firstToken['line'] === $prevToken['line']) {
+ return;
+ }
+ }
+
+ $error = 'Opening statement of multi-line function call not indented correctly; expected %s spaces but found %s';
+ $data = [
+ $functionIndent,
+ $foundFunctionIndent,
+ ];
+
+ $fix = $phpcsFile->addFixableError($error, $first, 'OpeningIndent', $data);
+ if ($fix !== true) {
+ return;
+ }
+
+ $padding = str_repeat(' ', $functionIndent);
+
+ if ($foundFunctionIndent === 0) {
+ $phpcsFile->fixer->addContentBefore($first, $padding);
+ } else if ($tokens[$first]['code'] === T_INLINE_HTML) {
+ $newContent = $padding.ltrim($tokens[$first]['content']);
+ $phpcsFile->fixer->replaceToken($first, $newContent);
+ } else if ($tokens[($first - 1)]['code'] === T_WHITESPACE) {
+ $phpcsFile->fixer->replaceToken(($first - 1), $padding);
+ }
+
+ }//end complainOpenStatementWrongIndent()
+
+
}//end class
diff --git a/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc b/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc
index fddd3cba18..833d176224 100644
--- a/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc
+++ b/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc
@@ -574,3 +574,75 @@ content
'my_file.php'
); ?>
+
+foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+
+// Initial call spaces only, params mixed.
+ $result = doThing($one, $two ,
+ $three,
+ $four,
+ $five,
+ $six,
+ $seven,
+ $eight);
+
+// Initial call tab only, param spaces.
+ $result = doThing($one,
+ $two);
+
+// Initial call tab only, param tab.
+ $result = doThing($one,
+ $two);
+
+// Initial call tab and space, param tab and space.
+ $result = doThing($one,
+ $two);
+
+// Initial call space only, param tab and space.
+ $result = doThing($one,
+ $two);
+
+// Initial call space only, param tab only.
+ $result = doThing($one,
+ $two);
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
+ $p_header['version_extracted'], $p_header['flag'],
+ $p_header['compression'], $v_mtime, $v_mdate,
+ $p_header['crc'], $p_header['compressed_size'],
+ $p_header['size'],
+ strlen($p_header['stored_filename']),
+ $p_header['extra_len']);
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
+ "Filename '".$v_header['stored_filename']."' is "
+ ."compressed by an unsupported compression "
+ ."method (".$v_header['compression'].") ");
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ if ($v_size > 2) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+ "Invalid number / type of arguments");
+ return 0;
+ }
+
+// Real example of mixed tab/space indention from WordPress codebase.
+// Not aligned on a 4-space indent
+ return chr(0x07 & (ord($utf8[0]) >> 2))
+ . chr((0xC0 & (ord($utf8[0]) << 6))
+ | (0x3F & ord($utf8[1])));
diff --git a/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed b/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed
index 1c52523075..e6dce67d48 100644
--- a/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed
+++ b/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed
@@ -227,13 +227,13 @@ test();
?>
+ '/theme_extra/test_block.php'
+ ); ?>
content
-
-
+ ); ?>
+
+foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+
+// Initial call spaces only, params mixed.
+ $result = doThing(
+ $one, $two ,
+ $three,
+ $four,
+ $five,
+ $six,
+ $seven,
+ $eight
+ );
+
+// Initial call tab only, param spaces.
+$result = doThing(
+ $one,
+ $two
+);
+
+// Initial call tab only, param tab.
+$result = doThing(
+ $one,
+ $two
+);
+
+// Initial call tab and space, param tab and space.
+$result = doThing(
+ $one,
+ $two
+);
+
+// Initial call space only, param tab and space.
+ $result = doThing(
+ $one,
+ $two
+ );
+
+// Initial call space only, param tab only.
+ $result = doThing(
+ $one,
+ $two
+ );
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ $v_binary_data = pack(
+ "VvvvvvVVVvv", 0x04034b50,
+ $p_header['version_extracted'], $p_header['flag'],
+ $p_header['compression'], $v_mtime, $v_mdate,
+ $p_header['crc'], $p_header['compressed_size'],
+ $p_header['size'],
+ strlen($p_header['stored_filename']),
+ $p_header['extra_len']
+ );
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ PclZip::privErrorLog(
+ PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
+ "Filename '".$v_header['stored_filename']."' is "
+ ."compressed by an unsupported compression "
+ ."method (".$v_header['compression'].") "
+ );
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ if ($v_size > 2) {
+ PclZip::privErrorLog(
+ PCLZIP_ERR_INVALID_PARAMETER,
+ "Invalid number / type of arguments"
+ );
+ return 0;
+ }
+
+// Real example of mixed tab/space indention from WordPress codebase.
+// Not aligned on a 4-space indent
+ return chr(0x07 & (ord($utf8[0]) >> 2))
+ . chr(
+ (0xC0 & (ord($utf8[0]) << 6))
+ | (0x3F & ord($utf8[1]))
+ );
diff --git a/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php b/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php
index 5884bd8f7a..a4f12b9b02 100644
--- a/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php
+++ b/src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php
@@ -74,7 +74,7 @@ public function getErrorList($testFile='')
82 => 1,
93 => 1,
100 => 1,
- 106 => 2,
+ 106 => 1,
119 => 1,
120 => 1,
129 => 1,
@@ -88,6 +88,10 @@ public function getErrorList($testFile='')
215 => 2,
217 => 2,
218 => 2,
+ 225 => 1,
+ 226 => 1,
+ 230 => 1,
+ 231 => 1,
277 => 1,
278 => 1,
303 => 1,
@@ -103,15 +107,9 @@ public function getErrorList($testFile='')
346 => 2,
353 => 1,
354 => 1,
- 355 => 2,
+ 355 => 1,
377 => 1,
- 378 => 1,
- 379 => 1,
- 380 => 1,
385 => 1,
- 386 => 1,
- 387 => 1,
- 388 => 1,
393 => 1,
394 => 1,
395 => 1,
@@ -136,11 +134,44 @@ public function getErrorList($testFile='')
546 => 1,
547 => 1,
548 => 1,
- 559 => 1,
- 567 => 1,
+ 555 => 1,
+ 556 => 1,
+ 560 => 1,
+ 561 => 1,
568 => 1,
- 573 => 1,
- 574 => 1,
+ 581 => 1,
+ 587 => 1,
+ 594 => 1,
+ 595 => 1,
+ 596 => 1,
+ 597 => 1,
+ 598 => 1,
+ 599 => 1,
+ 600 => 1,
+ 603 => 2,
+ 604 => 2,
+ 607 => 2,
+ 608 => 2,
+ 611 => 2,
+ 612 => 2,
+ 615 => 1,
+ 616 => 2,
+ 619 => 1,
+ 620 => 1,
+ 623 => 1,
+ 624 => 1,
+ 625 => 1,
+ 626 => 1,
+ 627 => 1,
+ 628 => 1,
+ 629 => 2,
+ 632 => 2,
+ 633 => 1,
+ 635 => 2,
+ 639 => 2,
+ 640 => 2,
+ 647 => 2,
+ 648 => 1,
];
}//end getErrorList()
diff --git a/src/Standards/PSR2/Sniffs/Methods/FunctionCallSignatureSniff.php b/src/Standards/PSR2/Sniffs/Methods/FunctionCallSignatureSniff.php
index cee18cacde..35fc51cbd2 100644
--- a/src/Standards/PSR2/Sniffs/Methods/FunctionCallSignatureSniff.php
+++ b/src/Standards/PSR2/Sniffs/Methods/FunctionCallSignatureSniff.php
@@ -25,7 +25,7 @@ class FunctionCallSignatureSniff extends PEARFunctionCallSignatureSniff
/**
- * Processes single-line calls.
+ * Determine if this is a multi-line function call.
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token
@@ -76,4 +76,26 @@ public function isMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $token
}//end isMultiLineCall()
+ /**
+ * No-op; this rule does not apply to PSR-2.
+ *
+ * @param File $phpcsFile The file being scanned.
+ * @param int $first Pointer to the first empty token on this line.
+ * @param array $tokens The stack of tokens that make up the file.
+ * @param int $functionIndent The expected indent for this function definition.
+ * @param int $foundFunctionIndent The actual indent for this function definition.
+ *
+ * @return void
+ */
+ protected function complainOpenStatementWrongIndent(
+ $phpcsFile,
+ $first,
+ $tokens,
+ $functionIndent,
+ $foundFunctionIndent
+ ) {
+
+ }//end complainOpenStatementWrongIndent()
+
+
}//end class
diff --git a/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc b/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc
index 1ca477d054..956d2b315e 100644
--- a/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc
+++ b/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc
@@ -265,3 +265,75 @@ array_fill_keys(
), value: true,
);
// phpcs:set PSR2.Methods.FunctionCallSignature allowMultipleArguments false
+
+// https://github.com/squizlabs/PHP_CodeSniffer/issues/2078#issuecomment-401641650
+// This sniff should accept both of these styles. Generic.WhiteSpace.ScopeIndent can complain & fix this if enabled.
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+
+// Initial call spaces only, params mixed.
+ $result = doThing($one, $two ,
+ $three,
+ $four,
+ $five,
+ $six,
+ $seven,
+ $eight);
+
+// Initial call tab only, param spaces.
+ $result = doThing($one,
+ $two);
+
+// Initial call tab only, param tab.
+ $result = doThing($one,
+ $two);
+
+// Initial call tab and space, param tab and space.
+ $result = doThing($one,
+ $two);
+
+// Initial call space only, param tab and space.
+ $result = doThing($one,
+ $two);
+
+// Initial call space only, param tab only.
+ $result = doThing($one,
+ $two);
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
+ $p_header['version_extracted'], $p_header['flag'],
+ $p_header['compression'], $v_mtime, $v_mdate,
+ $p_header['crc'], $p_header['compressed_size'],
+ $p_header['size'],
+ strlen($p_header['stored_filename']),
+ $p_header['extra_len']);
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
+ "Filename '".$v_header['stored_filename']."' is "
+ ."compressed by an unsupported compression "
+ ."method (".$v_header['compression'].") ");
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ if ($v_size > 2) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+ "Invalid number / type of arguments");
+ return 0;
+ }
+
+// Real example of mixed tab/space indention from WordPress codebase.
+// Not aligned on a 4-space indent
+ return chr(0x07 & (ord($utf8[0]) >> 2))
+ . chr((0xC0 & (ord($utf8[0]) << 6))
+ | (0x3F & ord($utf8[1])));
diff --git a/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc.fixed b/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc.fixed
index dc383ed2a7..a3a9e1cd72 100644
--- a/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc.fixed
+++ b/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.inc.fixed
@@ -281,3 +281,99 @@ array_fill_keys(
), value: true,
);
// phpcs:set PSR2.Methods.FunctionCallSignature allowMultipleArguments false
+
+// https://github.com/squizlabs/PHP_CodeSniffer/issues/2078#issuecomment-401641650
+// This sniff should accept both of these styles. Generic.WhiteSpace.ScopeIndent can complain & fix this if enabled.
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+$repository->foo()
+ ->bar(
+ function () {
+ return true;
+ }
+ );
+
+// Initial call spaces only, params mixed.
+ $result = doThing(
+ $one,
+ $two ,
+ $three,
+ $four,
+ $five,
+ $six,
+ $seven,
+ $eight
+ );
+
+// Initial call tab only, param spaces.
+ $result = doThing(
+ $one,
+ $two
+);
+
+// Initial call tab only, param tab.
+ $result = doThing(
+ $one,
+ $two
+);
+
+// Initial call tab and space, param tab and space.
+ $result = doThing(
+ $one,
+ $two
+);
+
+// Initial call space only, param tab and space.
+ $result = doThing(
+ $one,
+ $two
+ );
+
+// Initial call space only, param tab only.
+ $result = doThing(
+ $one,
+ $two
+ );
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ $v_binary_data = pack(
+ "VvvvvvVVVvv",
+ 0x04034b50,
+ $p_header['version_extracted'],
+ $p_header['flag'],
+ $p_header['compression'],
+ $v_mtime,
+ $v_mdate,
+ $p_header['crc'],
+ $p_header['compressed_size'],
+ $p_header['size'],
+ strlen($p_header['stored_filename']),
+ $p_header['extra_len']
+ );
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ PclZip::privErrorLog(
+ PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
+ "Filename '".$v_header['stored_filename']."' is "
+ ."compressed by an unsupported compression "
+ ."method (".$v_header['compression'].") "
+ );
+
+// Real example of mixed tab/space indention from WordPress codebase.
+ if ($v_size > 2) {
+ PclZip::privErrorLog(
+ PCLZIP_ERR_INVALID_PARAMETER,
+ "Invalid number / type of arguments"
+ );
+ return 0;
+ }
+
+// Real example of mixed tab/space indention from WordPress codebase.
+// Not aligned on a 4-space indent
+ return chr(0x07 & (ord($utf8[0]) >> 2))
+ . chr((0xC0 & (ord($utf8[0]) << 6))
+ | (0x3F & ord($utf8[1])));
diff --git a/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.php b/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.php
index 52cda17467..aa051c2382 100644
--- a/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.php
+++ b/src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.php
@@ -57,12 +57,12 @@ public function getErrorList()
187 => 1,
194 => 3,
199 => 1,
- 200 => 2,
+ 200 => 1,
202 => 1,
203 => 1,
210 => 2,
211 => 1,
- 212 => 2,
+ 212 => 1,
217 => 1,
218 => 1,
227 => 1,
@@ -76,6 +76,35 @@ public function getErrorList()
258 => 1,
263 => 1,
264 => 1,
+ 285 => 2,
+ 286 => 1,
+ 287 => 1,
+ 288 => 1,
+ 289 => 1,
+ 290 => 1,
+ 291 => 1,
+ 294 => 1,
+ 295 => 2,
+ 298 => 1,
+ 299 => 2,
+ 302 => 1,
+ 303 => 2,
+ 306 => 1,
+ 307 => 2,
+ 310 => 1,
+ 311 => 1,
+ 314 => 2,
+ 315 => 2,
+ 316 => 3,
+ 317 => 2,
+ 318 => 1,
+ 319 => 1,
+ 320 => 2,
+ 323 => 1,
+ 324 => 1,
+ 326 => 2,
+ 330 => 1,
+ 331 => 2,
];
}//end getErrorList()
diff --git a/src/Standards/PSR2/ruleset.xml b/src/Standards/PSR2/ruleset.xml
index ba5bd4e0ba..190502de61 100644
--- a/src/Standards/PSR2/ruleset.xml
+++ b/src/Standards/PSR2/ruleset.xml
@@ -151,9 +151,6 @@
0
-
- 0
-