feature #21350 [Yaml] Remove internal arguments from the api (GuilhemN)
This PR was squashed before being merged into the 3.3-dev branch (closes #21350).
Discussion
----------
[Yaml] Remove internal arguments from the api
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21230
| License | MIT
| Doc PR |
Reopening of https://github.com/symfony/symfony/pull/21230 because of [@xabbuh's comment](https://github.com/symfony/symfony/pull/21194#discussion_r96732559).
> This PR removes internal constructor arguments of the `Parser` class.
> This should break nothing as they are only used to build errors message and are clearly meant for internal uses.
>
> This would allow to have a nicer api for https://github.com/symfony/symfony/pull/21194#discussion_r95158384.
Commits
-------
ebae4ff
[Yaml] Remove internal arguments from the api
This commit is contained in:
commit
0abe862761
@ -64,3 +64,10 @@ Workflow
|
|||||||
|
|
||||||
* Deprecated class name support in `WorkflowRegistry::add()` as second parameter.
|
* Deprecated class name support in `WorkflowRegistry::add()` as second parameter.
|
||||||
Wrap the class name in an instance of ClassInstanceSupportStrategy instead.
|
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
|
||||||
|
@ -390,6 +390,9 @@ Yaml
|
|||||||
|
|
||||||
* Duplicate mapping keys lead to a `ParseException`.
|
* Duplicate mapping keys lead to a `ParseException`.
|
||||||
|
|
||||||
|
* The constructor arguments `$offset`, `$totalNumberOfLines` and
|
||||||
|
`$skippedLineNumbers` of the `Parser` class were removed.
|
||||||
|
|
||||||
Ldap
|
Ldap
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -32,18 +32,19 @@ class Parser
|
|||||||
private $skippedLineNumbers = array();
|
private $skippedLineNumbers = array();
|
||||||
private $locallySkippedLineNumbers = array();
|
private $locallySkippedLineNumbers = array();
|
||||||
|
|
||||||
/**
|
public function __construct()
|
||||||
* 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())
|
|
||||||
{
|
{
|
||||||
$this->offset = $offset;
|
if (func_num_args() > 0) {
|
||||||
$this->totalNumberOfLines = $totalNumberOfLines;
|
@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->skippedLineNumbers = $skippedLineNumbers;
|
|
||||||
|
$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;
|
$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;
|
$parser->refs = &$this->refs;
|
||||||
|
|
||||||
return $parser->parse($yaml, $flags);
|
return $parser->parse($yaml, $flags);
|
||||||
|
Reference in New Issue
Block a user