Skip to content

Commit

Permalink
Merge branch '3.4' into 4.1
Browse files Browse the repository at this point in the history
* 3.4:
  [travis][appveyor] use symfony/flex to accelerate builds
  Add missing stderr redirection
  clean up unused code
  [Filesystem] Add test to prevent regression when using array|resource with dumpFile
  [Security] Call AccessListener after LogoutListener
  • Loading branch information
nicolas-grekas committed Aug 18, 2018
2 parents 46bc69a + c2f4812 commit b832cc2
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,6 @@ private function getCurrentLineIndentation(): int
private function getNextEmbedBlock(int $indentation = null, bool $inSequence = false): ?string
{
$oldLineIndentation = $this->getCurrentLineIndentation();
$blockScalarIndentations = array();

if ($this->isBlockScalarHeader()) {
$blockScalarIndentations[] = $oldLineIndentation;
}

if (!$this->moveToNextLine()) {
return null;
Expand Down Expand Up @@ -562,30 +557,9 @@ private function getNextEmbedBlock(int $indentation = null, bool $inSequence = f

$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();

if (empty($blockScalarIndentations) && $this->isBlockScalarHeader()) {
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
}

$previousLineIndentation = $this->getCurrentLineIndentation();

while ($this->moveToNextLine()) {
$indent = $this->getCurrentLineIndentation();

// terminate all block scalars that are more indented than the current line
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
if ($blockScalarIndentation >= $indent) {
unset($blockScalarIndentations[$key]);
}
}
}

if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) {
$blockScalarIndentations[] = $indent;
}

$previousLineIndentation = $indent;

if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
$this->moveToPreviousLine();
break;
Expand Down Expand Up @@ -1002,16 +976,6 @@ private function isStringUnIndentedCollectionItem(): bool
return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- ');
}

/**
* Tests whether or not the current line is the header of a block scalar.
*
* @return bool
*/
private function isBlockScalarHeader(): bool
{
return (bool) self::preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine);
}

/**
* A local wrapper for `preg_match` which will throw a ParseException if there
* is an internal error in the PCRE engine.
Expand Down

0 comments on commit b832cc2

Please # to comment.