Skip to content

Commit

Permalink
feature #20938 [DI] Prepare dropping "strict" handling in loaders (ni…
Browse files Browse the repository at this point in the history
…colas-grekas)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Prepare dropping "strict" handling in loaders

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

"strict" has been deprecated in 2.8, removed from 3.0, but loaders still read them
(note that the XSD still mentions it for BC at XML level, but it has no effect.)

We could also deprecate the attribute in XML, but I don't see the need since it's already ignored.
In YAML, we need people to remove this trailing `=`, which is why the PR is on master with a deprecation.

Commits
-------

243d160 [DI] Prepare dropping "strict" handling in loaders
  • Loading branch information
fabpot committed Dec 26, 2016
2 parents 7bc268e + 243d160 commit 5a0157f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Expand Up @@ -387,13 +387,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $lowercase = true)
$invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
}

if ($strict = $arg->getAttribute('strict')) {
$strict = XmlUtils::phpize($strict);
} else {
$strict = true;
}

$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior, $strict);
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
break;
case 'expression':
$arguments[$key] = new Expression($arg->nodeValue);
Expand Down
Expand Up @@ -471,14 +471,12 @@ private function resolveServices($value)
}

if ('=' === substr($value, -1)) {
@trigger_error(sprintf('The "=" suffix that used to disable strict references in Symfony 2.x is deprecated since 3.3 and will be unsupported in 4.0. Remove it in "%s".', $value), E_USER_DEPRECATED);
$value = substr($value, 0, -1);
$strict = false;
} else {
$strict = true;
}

if (null !== $invalidBehavior) {
$value = new Reference($value, $invalidBehavior, $strict);
$value = new Reference($value, $invalidBehavior);
}
}

Expand Down

0 comments on commit 5a0157f

Please sign in to comment.