Skip to content

Commit

Permalink
Simplified some code
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Jan 12, 2015
1 parent 0a04c87 commit d6e8a70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/Passes/OptimizeControlStructures.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ protected function optimizeStructure(array $structure)
$this->optimizeStructures($structure['structures']);
}

if (!isset($structure['offsetRightBrace']))
{
return;
}

if ($structure['isIf'] || $structure['isElseif'])
{
$this->markPreservedBraces($structure['offsetRightBrace']);
}

if ($structure['statements'] <= 1
&& isset($structure['offsetRightBrace'])
&& !isset($this->preservedBraces[$structure['offsetRightBrace']]))
if ($structure['statements'] <= 1 && !isset($this->preservedBraces[$structure['offsetRightBrace']]))
{
if ($structure['isElse'])
{
Expand Down
4 changes: 2 additions & 2 deletions src/TokenStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ public function offsetUnset($offset)
/**
* Return the current token
*
* @return array|string|null
* @return array|string
*/
public function current()
{
return (isset($this->tokens[$this->offset])) ? $this->tokens[$this->offset] : null;
return $this->tokens[$this->offset];
}

/**
Expand Down

0 comments on commit d6e8a70

Please sign in to comment.