upgraded dependencies

This commit is contained in:
RafficMohammed
2023-01-08 01:59:16 +05:30
parent 51056e3aad
commit f9ae387337
6895 changed files with 133617 additions and 178680 deletions

View File

@@ -29,6 +29,7 @@ class Parser
private $filename;
private $offset = 0;
private $numberOfParsedLines = 0;
private $totalNumberOfLines;
private $lines = [];
private $currentLineNb = -1;
@@ -44,7 +45,7 @@ class Parser
* @param string $filename The path to the YAML file to be parsed
* @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
*
* @return mixed The YAML converted to a PHP value
* @return mixed
*
* @throws ParseException If the file could not be read or the YAML is not valid
*/
@@ -73,7 +74,7 @@ class Parser
* @param string $value A YAML string
* @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
*
* @return mixed A PHP value
* @return mixed
*
* @throws ParseException If the YAML is not valid
*/
@@ -102,6 +103,7 @@ class Parser
$this->offset = 0;
$this->lines = [];
$this->currentLine = '';
$this->numberOfParsedLines = 0;
$this->refs = [];
$this->skippedLineNumbers = [];
$this->locallySkippedLineNumbers = [];
@@ -117,10 +119,11 @@ class Parser
$this->currentLine = '';
$value = $this->cleanup($value);
$this->lines = explode("\n", $value);
$this->numberOfParsedLines = \count($this->lines);
$this->locallySkippedLineNumbers = [];
if (null === $this->totalNumberOfLines) {
$this->totalNumberOfLines = \count($this->lines);
$this->totalNumberOfLines = $this->numberOfParsedLines;
}
if (!$this->moveToNextLine()) {
@@ -447,7 +450,8 @@ class Parser
$value = '';
foreach ($this->lines as $line) {
if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
$trimmedLine = trim($line);
if ('#' === ($trimmedLine[0] ?? '')) {
continue;
}
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
@@ -456,22 +460,22 @@ class Parser
}
if (false !== strpos($line, ': ')) {
@trigger_error('Support for mapping keys in multi-line blocks is deprecated since Symfony 4.3 and will throw a ParseException in 5.0.', \E_USER_DEPRECATED);
throw new ParseException('Mapping values are not allowed in multi-line blocks.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}
if ('' === trim($line)) {
if ('' === $trimmedLine) {
$value .= "\n";
} elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) {
$value .= ' ';
}
if ('' !== trim($line) && '\\' === substr($line, -1)) {
if ('' !== $trimmedLine && '\\' === substr($line, -1)) {
$value .= ltrim(substr($line, 0, -1));
} elseif ('' !== trim($line)) {
$value .= trim($line);
} elseif ('' !== $trimmedLine) {
$value .= $trimmedLine;
}
if ('' === trim($line)) {
if ('' === $trimmedLine) {
$previousLineWasNewline = true;
$previousLineWasTerminatedWithBackslash = false;
} elseif ('\\' === substr($line, -1)) {
@@ -498,7 +502,7 @@ class Parser
$data = new TaggedValue($tag, $data);
}
if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && !\is_object($data) && 'mapping' === $context) {
if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && 'mapping' === $context && !\is_object($data)) {
$object = new \stdClass();
foreach ($data as $key => $value) {
@@ -537,8 +541,6 @@ class Parser
* Returns the current line number (takes the offset into account).
*
* @internal
*
* @return int The current line number
*/
public function getRealCurrentLineNb(): int
{
@@ -557,11 +559,13 @@ class Parser
/**
* Returns the current line indentation.
*
* @return int The current line indentation
*/
private function getCurrentLineIndentation(): int
{
if (' ' !== ($this->currentLine[0] ?? '')) {
return 0;
}
return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' '));
}
@@ -571,8 +575,6 @@ class Parser
* @param int|null $indentation The indent level at which the block is to be read, or null for default
* @param bool $inSequence True if the enclosing data structure is a sequence
*
* @return string A YAML string
*
* @throws ParseException When indentation problem are detected
*/
private function getNextEmbedBlock(int $indentation = null, bool $inSequence = false): string
@@ -682,7 +684,7 @@ class Parser
*/
private function moveToNextLine(): bool
{
if ($this->currentLineNb >= \count($this->lines) - 1) {
if ($this->currentLineNb >= $this->numberOfParsedLines - 1) {
return false;
}
@@ -712,7 +714,7 @@ class Parser
* @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
* @param string $context The parser context (either sequence or mapping)
*
* @return mixed A PHP value
* @return mixed
*
* @throws ParseException When reference does not exist
*/
@@ -932,8 +934,6 @@ class Parser
/**
* Returns true if the next line is indented.
*
* @return bool Returns true if the next line is indented, false otherwise
*/
private function isNextLineIndented(): bool
{
@@ -963,8 +963,6 @@ class Parser
/**
* Returns true if the current line is blank or if it is a comment line.
*
* @return bool Returns true if the current line is empty or if it is a comment line, false otherwise
*/
private function isCurrentLineEmpty(): bool
{
@@ -973,23 +971,19 @@ class Parser
/**
* Returns true if the current line is blank.
*
* @return bool Returns true if the current line is blank, false otherwise
*/
private function isCurrentLineBlank(): bool
{
return '' == trim($this->currentLine, ' ');
return '' === $this->currentLine || '' === trim($this->currentLine, ' ');
}
/**
* Returns true if the current line is a comment line.
*
* @return bool Returns true if the current line is a comment line, false otherwise
*/
private function isCurrentLineComment(): bool
{
// checking explicitly the first char of the trim is faster than loops or strpos
$ltrimmedLine = ltrim($this->currentLine, ' ');
$ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine;
return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
}
@@ -1003,8 +997,6 @@ class Parser
* Cleanups a YAML string to be parsed.
*
* @param string $value The input YAML string
*
* @return string A cleaned up YAML string
*/
private function cleanup(string $value): string
{
@@ -1039,8 +1031,6 @@ class Parser
/**
* Returns true if the next line starts unindented collection.
*
* @return bool Returns true if the next line starts unindented collection, false otherwise
*/
private function isNextLineUnIndentedCollection(): bool
{
@@ -1070,8 +1060,6 @@ class Parser
/**
* Returns true if the string is un-indented collection item.
*
* @return bool Returns true if the string is un-indented collection item, false otherwise
*/
private function isStringUnIndentedCollectionItem(): bool
{