Skip to content

Commit ebae4ff

Browse files
GuilhemNxabbuh
authored andcommitted
[Yaml] Remove internal arguments from the api
1 parent 63b8d31 commit ebae4ff

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

UPGRADE-3.3.md

+7
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+
* The constructor arguments `$offset`, `$totalNumberOfLines` and
73+
`$skippedLineNumbers` of the `Parser` class are deprecated and will be
74+
removed in 4.0

UPGRADE-4.0.md

+3
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ Yaml
391391

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

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

src/Symfony/Component/Yaml/Parser.php

+17-12
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ class Parser
3232
private $skippedLineNumbers = array();
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('The 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)