8000 [Yaml] Remove internal arguments from the api · symfony/symfony@847fda8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 847fda8

Browse files
committed
[Yaml] Remove internal arguments from the api
1 parent 63b8d31 commit 847fda8

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

UPGRADE-3.3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ Workflow
6565

6666
* Deprecated class name support in `WorkflowRegistry::add()` as second parameter.
6767
Wrap the class name in an instance of ClassInstanceSupportStrategy instead.
68+
69+
Yaml
70+
----
71+
72+
* Constructor arguments `$offset`, `$totalNumberOfLines` and
73+
`$skippedLineNumbers` of `Parser` are deprecated and will be
74+
removed in 4.0

UPGRADE-4.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ Yaml
391391

392392
* Duplicate mapping keys lead to a `ParseException`.
393393

394+
* Constructor arguments `$offset`, `$totalNumberOfLines` and
395+
`$skippedLineNumbers` of `Parser` were removed.
396+
394397
Ldap
395398
----
396399

src/Symfony/Component/Yaml/Parser.php

Lines changed: 17 additions & 12 deletions
< 8000 td data-grid-cell-id="diff-0a12ae513347f5548e97b59d07e5648e5a83298e73a36e77e1ee9e597dbe3f5a-32-32-2" data-line-anchor="diff-0a12ae513347f5548e97b59d07e5648e5a83298e73a36e77e1ee9e597dbe3f5aR32" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">
private $skippedLineNumbers = array();
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ class Parser
3232
3333
private $locallySkippedLineNumbers = array();
3434

35-
/**
36-
* Constructor.
37-
*
38-
* @param int $offset The offset of YAML document (used for line numbers in error messages)
39-
* @param int|null $totalNumberOfLines The overall number of lines being parsed
40-
* @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser
41-
*/
42-
public function __construct($offset = 0, $totalNumberOfLines = null, array $skippedLineNumbers = array())
35+
public function __construct()
4336
{
44-
$this->offset = $offset;
45-
$this->totalNumberOfLines = $totalNumberOfLines;
46-
$this->skippedLineNumbers = $skippedLineNumbers;
37+
if (func_num_args() > 0) {
38+
@trigger_error(sprintf('Constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0', self::class), E_USER_DEPRECATED);
39+
40+
$this->offset = func_get_arg(0);
41+
if (func_num_args() > 1) {
42+
$this->totalNumberOfLines = func_get_arg(1);
43+
}
44+
if (func_num_args() > 2) {
45+
$this->skippedLineNumbers = func_get_arg(2);
46+
}
47+
}
4748
}
4849

4950
/**
@@ -384,7 +385,11 @@ private function parseBlock($offset, $yaml, $flags)
384385
$skippedLineNumbers[] = $lineNumber;
385386
}
386387

387-
$parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers);
388+
$parser = new self();
389+
$parser->offset = $offset;
390+
$parser->totalNumberOfLines = $this->totalNumberOfLines;
391+
$parser->skippedLineNumbers = $skippedLineNumbers;
392+
388393
$parser->refs = &$this->refs;
389394

390395
return $parser->parse($yaml, $flags);

0 commit comments

Comments
 (0)
0