protected function removeBracesInCurrentContext()
	{
		// Replace the first brace with the saved replacement
		$this->tokens[$this->context['index']] = $this->context['replacement'];

		// Remove the second brace or replace it with a semicolon if there are no statements in this
		// block
		$this->tokens[$this->i] = ($this->context['statements']) ? [T_WHITESPACE, ''] : ';';

		// Remove the whitespace before braces. This is mainly cosmetic
		foreach ([$this->context['index'] - 1, $this->i - 1] as $tokenIndex)
		{
			if ($this->tokens[$tokenIndex][0] === T_WHITESPACE)
			{
				$this->tokens[$tokenIndex][1] = '';
			}
		}

		// Test whether the current block followed an else statement then test whether this
		// else was followed by an if
		if ($this->tokens[$this->context['savedIndex']][0] === T_ELSE)
		{
			$j = 1 + $this->context['savedIndex'];

			while ($this->tokens[$j][0] === T_WHITESPACE
			    || $this->tokens[$j][0] === T_COMMENT
			    || $this->tokens[$j][0] === T_DOC_COMMENT)
			{
				++$j;
			}

			if ($this->tokens[$j][0] === T_IF)
			{
				// Replace if with elseif
				$this->tokens[$j] = [T_ELSEIF, 'elseif'];

				// Remove the original else
				$j = $this->context['savedIndex'];
				$this->tokens[$j] = [T_WHITESPACE, ''];

				// Remove any whitespace before the original else
				if ($this->tokens[$j - 1][0] === T_WHITESPACE)
				{
					$this->tokens[$j - 1][1] = '';
				}

				// Unindent what was the else's content
				$this->unindentBlock($j, $this->i - 1);

				// Ensure that the brace after the now-removed "else" was not replaced with a space
				$this->tokens[$this->context['index']] = [T_WHITESPACE, ''];
			}
		}

		$this->changed = true;
	}
protected function removeBracesInCurrentContext()
	{
		// Replace the first brace with the saved replacement
		$this->tokens[$this->context['index']] = $this->context['replacement'];

		// Remove the second brace or replace it with a semicolon if there are no statements in this
		// block
		$this->tokens[$this->i] = ($this->context['statements']) ? [T_WHITESPACE, ''] : ';';

		// Remove the whitespace before braces. This is mainly cosmetic
		foreach ([$this->context['index'] - 1, $this->i - 1] as $tokenIndex)
		{
			if ($this->tokens[$tokenIndex][0] === T_WHITESPACE)
			{
				$this->tokens[$tokenIndex][1] = '';
			}
		}

		// Test whether the current block followed an else statement then test whether this
		// else was followed by an if
		if ($this->tokens[$this->context['savedIndex']][0] === T_ELSE)
		{
			$j = 1 + $this->context['savedIndex'];

			while ($this->tokens[$j][0] === T_WHITESPACE
			    || $this->tokens[$j][0] === T_COMMENT
			    || $this->tokens[$j][0] === T_DOC_COMMENT)
			{
				++$j;
			}

			if ($this->tokens[$j][0] === T_IF)
			{
				// Replace if with elseif
				$this->tokens[$j] = [T_ELSEIF, 'elseif'];

				// Remove the original else
				$j = $this->context['savedIndex'];
				$this->tokens[$j] = [T_WHITESPACE, ''];

				// Remove any whitespace before the original else
				if ($this->tokens[$j - 1][0] === T_WHITESPACE)
				{
					$this->tokens[$j - 1][1] = '';
				}

				// Unindent what was the else's content
				$this->unindentBlock($j, $this->i - 1);

				// Ensure that the brace after the now-removed "else" was not replaced with a space
				$this->tokens[$this->context['index']] = [T_WHITESPACE, ''];
			}
		}

		$this->changed = true;
	}
protected function removeBracesInCurrentContext ( ) { // Replace the first brace with the saved replacement $ this -> tokens [ $ this -> context [ 'index' ] ] = $ this -> context [ 'replacement' ] ; // Remove the second brace or replace it with a semicolon if there are no statements in this // block $ this -> tokens [ $ this -> i ] = ( $ this -> context [ 'statements' ] ) ? [ T_WHITESPACE , '' ] : ';' ; // Remove the whitespace before braces. This is mainly cosmetic foreach ( [ $ this -> context [ 'index' ] - 1 , $ this -> i - 1 ] as $ tokenIndex ) { if ( $ this -> tokens [ $ tokenIndex ] [ 0 ] === T_WHITESPACE ) { $ this -> tokens [ $ tokenIndex ] [ 1 ] = '' ; } } // Test whether the current block followed an else statement then test whether this // else was followed by an if if ( $ this -> tokens [ $ this -> context [ 'savedIndex' ] ] [ 0 ] === T_ELSE ) { $ j = 1 + $ this -> context [ 'savedIndex' ] ; while ( $ this -> tokens [ $ j ] [ 0 ] === T_WHITESPACE || $ this -> tokens [ $ j ] [ 0 ] === T_COMMENT || $ this -> tokens [ $ j ] [ 0 ] === T_DOC_COMMENT ) { ++ $ j ; } if ( $ this -> tokens [ $ j ] [ 0 ] === T_IF ) { // Replace if with elseif $ this -> tokens [ $ j ] = [ T_ELSEIF , 'elseif' ] ; // Remove the original else $ j = $ this -> context [ 'savedIndex' ] ; $ this -> tokens [ $ j ] = [ T_WHITESPACE , '' ] ; // Remove any whitespace before the original else if ( $ this -> tokens [ $ j - 1 ] [ 0 ] === T_WHITESPACE ) { $ this -> tokens [ $ j - 1 ] [ 1 ] = '' ; } // Unindent what was the else's content $ this -> unindentBlock ( $ j , $ this -> i - 1 ) ; // Ensure that the brace after the now-removed "else" was not replaced with a space $ this -> tokens [ $ this -> context [ 'index' ] ] = [ T_WHITESPACE , '' ] ; } } $ this -> changed = true ; }
Remove the braces surrounding current context

@return void
Remove the braces surrounding current context