Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a0157f

Browse files
committed
feature #20938 [DI] Prepare dropping "strict" handling in loaders (nicolas-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
2 parents 7bc268e + 243d160 commit 5a0157f

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $lowercase = true)
387387
$invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
388388
}
389389

390-
if ($strict = $arg->getAttribute('strict')) {
391-
$strict = XmlUtils::phpize($strict);
392-
} else {
393-
$strict = true;
394-
}
395-
396-
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior, $strict);
390+
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
397391
break;
398392
case 'expression':
399393
$arguments[$key] = new Expression($arg->nodeValue);

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,12 @@ private function resolveServices($value)
471471
}
472472

473473
if ('=' === substr($value, -1)) {
474+
@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);
474475
$value = substr($value, 0, -1);
475-
$strict = false;
476-
} else {
477-
$strict = true;
478476
}
479477

480478
if (null !== $invalidBehavior) {
481-
$value = new Reference($value, $invalidBehavior, $strict);
479+
$value = new Reference($value, $invalidBehavior);
482480
}
483481
}
484482

0 commit comments

Comments
 (0)