Skip to content

Commit

Permalink
Fixed bug #2849 : Generic.WhiteSpace.ScopeIndent false positive with …
Browse files Browse the repository at this point in the history
…arrow function inside array
  • Loading branch information
gsherwood committed Feb 2, 2020
1 parent 1cfba97 commit fbf67ef
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ 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>
- Fixed bug #2848 : PSR12.Files.FileHeader false positive for file with mixed PHP and HTML and no file header
- Fixed bug #2849 : Generic.WhiteSpace.ScopeIndent false positive with arrow function inside array
</notes>
<contents>
<dir name="/">
Expand Down
1 change: 1 addition & 0 deletions src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,7 @@ public function findStartOfStatement($start, $ignore=null)

if (isset($this->tokens[$i]['scope_opener']) === true
&& $i === $this->tokens[$i]['scope_closer']
&& $this->tokens[$i]['code'] !== T_CLOSE_PARENTHESIS
) {
// Found the end of the previous scope block.
return $lastNotEmpty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,15 @@ $a = $a === true ? [
'a' => 100,
];

return [
Url::make('View Song', fn($song) => $song->url())
->onlyOnDetail(),

new Panel('Information', [
Text::make('Title')
]),
];

?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,15 @@ $a = $a === true ? [
'a' => 100,
];

return [
Url::make('View Song', fn($song) => $song->url())
->onlyOnDetail(),

new Panel('Information', [
Text::make('Title')
]),
];

?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,15 @@ $a = $a === true ? [
'a' => 100,
];

return [
Url::make('View Song', fn($song) => $song->url())
->onlyOnDetail(),

new Panel('Information', [
Text::make('Title')
]),
];

?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,15 @@ $a = $a === true ? [
'a' => 100,
];

return [
Url::make('View Song', fn($song) => $song->url())
->onlyOnDetail(),

new Panel('Information', [
Text::make('Title')
]),
];

?>

<?php if (true) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ public function getErrorList($testFile='ScopeIndentUnitTest.inc')
1340 => 1,
1342 => 1,
1345 => 1,
1455 => 1,
1456 => 1,
1457 => 1,
1458 => 1,
1464 => 1,
1465 => 1,
1466 => 1,
1467 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit fbf67ef

Please sign in to comment.