[Yaml] Remove internal arguments from the api

This commit is contained in:
Guilhem N 2017-01-10 18:32:05 +01:00 committed by Christian Flothmann
parent 63b8d31885
commit ebae4ff01d
3 changed files with 27 additions and 12 deletions

View File

@ -65,3 +65,10 @@ Workflow
* Deprecated class name support in `WorkflowRegistry::add()` as second parameter.
Wrap the class name in an instance of ClassInstanceSupportStrategy instead.
Yaml
----
* The constructor arguments `$offset`, `$totalNumberOfLines` and
`$skippedLineNumbers` of the `Parser` class are deprecated and will be
removed in 4.0

View File

@ -391,6 +391,9 @@ Yaml
* Duplicate mapping keys lead to a `ParseException`.
* The constructor arguments `$offset`, `$totalNumberOfLines` and
`$skippedLineNumbers` of the `Parser` class were removed.
Ldap
----

View File

@ -32,18 +32,19 @@ class Parser
private $skippedLineNumbers = array();
private $locallySkippedLineNumbers = array();
/**
* Constructor.
*
* @param int $offset The offset of YAML document (used for line numbers in error messages)
* @param int|null $totalNumberOfLines The overall number of lines being parsed
* @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser
*/
public function __construct($offset = 0, $totalNumberOfLines = null, array $skippedLineNumbers = array())
public function __construct()
{
$this->offset = $offset;
$this->totalNumberOfLines = $totalNumberOfLines;
$this->skippedLineNumbers = $skippedLineNumbers;
if (func_num_args() > 0) {
@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);
$this->offset = func_get_arg(0);
if (func_num_args() > 1) {
$this->totalNumberOfLines = func_get_arg(1);
}
if (func_num_args() > 2) {
$this->skippedLineNumbers = func_get_arg(2);
}
}
}
/**
@ -384,7 +385,11 @@ class Parser
$skippedLineNumbers[] = $lineNumber;
}
$parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers);
$parser = new self();
$parser->offset = $offset;
$parser->totalNumberOfLines = $this->totalNumberOfLines;
$parser->skippedLineNumbers = $skippedLineNumbers;
$parser->refs = &$this->refs;
return $parser->parse($yaml, $flags);