Skip to content

Commit

Permalink
check for the presence of a scope closer (#173)
Browse files Browse the repository at this point in the history
fixes throwing an exception when inline control structures are used
this should be taken care of by the Generic.ControlStructures.InlineControlStructure
sniff so we can safely return

fixes #170
  • Loading branch information
wickedOne authored and djoos committed Sep 18, 2019
1 parent b131160 commit 245812d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Symfony/Sniffs/Formatting/ReturnOrThrowSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 95,10 @@ public function process(File $phpcsFile, $stackPtr)

$scopeCloserLine = -1;

if (false === isset($tokens[$opener]['scope_closer'])) {
return;
}

if ($opener) {
$scopeCloserLine = $tokens[$tokens[$opener]['scope_closer']]['line'];
}
Expand Down

0 comments on commit 245812d

Please sign in to comment.