Skip to content

Commit e1dcba4

Browse files
committed
Changelog for #2372 (ref #2371)
2 parents c383803 + 6e315f1 commit e1dcba4

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

package.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
3232
-- Use --filter=gitstaged to check these files
3333
-- You still need to give PHPCS a list of files or directories in which to apply the filter
3434
-- Thanks to Juliette Reinders Folmer for the contribution
35+
- Generic.WhiteSpace.ScopeIndent no longer performs exact indents checking for chained method calls
36+
-- Other sniffs can be used to enforce chained method call indent rules
37+
-- Thanks to Pieter Frenssen for the patch
3538
- PSR2.ControlStructures.ControlStructureSpacing now allows whitespace after the opening parenthesis if followed by a comment
3639
-- Thanks to Michał Bundyra for the patch
3740
- The T_LIST token and it's opening and closing parentheses now contain references to each other in the tokens array

src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,15 @@ public function process(File $phpcsFile, $stackPtr)
922922
$exact = true;
923923
}
924924

925+
// Don't perform strict checking on chained method calls since they
926+
// are often covered by custom rules.
927+
if ($checkToken !== null
928+
&& $tokens[$checkToken]['code'] === T_OBJECT_OPERATOR
929+
&& $exact === true
930+
) {
931+
$exact = false;
932+
}
933+
925934
if ($checkIndent === null) {
926935
$checkIndent = $currentIndent;
927936
}

src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ if ($foo) {
2222
'compression' => $compression,
2323
] = $options;
2424
}
25+
26+
$this->foo()
27+
->bar()
28+
->baz();

src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.3.inc.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ if ($foo) {
2222
'compression' => $compression,
2323
] = $options;
2424
}
25+
26+
$this->foo()
27+
->bar()
28+
->baz();

0 commit comments

Comments
 (0)