You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #21348 [DependencyInjection] Yaml: check if $tags is an array before using it (dunglas)
This PR was squashed before being merged into the 3.3-dev branch (closes#21348).
Discussion
----------
[DependencyInjection] Yaml: check if $tags is an array before using it
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
1c9b5c9 [DependencyInjection] Yaml: check if is an array before using it
thrownewInvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
369
+
foreach ($tagsas$tag) {
370
+
if (!is_array($tag)) {
371
+
$tag = array('name' => $tag);
369
372
}
370
373
371
-
foreach ($tagsas$tag) {
372
-
if (!is_array($tag)) {
373
-
$tag = array('name' => $tag);
374
-
}
375
-
376
-
if (!isset($tag['name'])) {
377
-
thrownewInvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
378
-
}
379
-
$name = $tag['name'];
380
-
unset($tag['name']);
374
+
if (!isset($tag['name'])) {
375
+
thrownewInvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
376
+
}
377
+
$name = $tag['name'];
378
+
unset($tag['name']);
381
379
382
-
if (!is_string($name) || '' === $name) {
383
-
thrownewInvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', $id, $file));
384
-
}
380
+
if (!is_string($name) || '' === $name) {
381
+
thrownewInvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', $id, $file));
382
+
}
385
383
386
-
foreach ($tagas$attribute => $value) {
387
-
if (!is_scalar($value) && null !== $value) {
388
-
thrownewInvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in %s. Check your YAML syntax.', $id, $name, $attribute, $file));
389
-
}
384
+
foreach ($tagas$attribute => $value) {
385
+
if (!is_scalar($value) && null !== $value) {
386
+
thrownewInvalidArgumentException(sprintf('A "tags" attribute
10000
must be of a scalar-type for service "%s", tag "%s", attribute "%s" in %s. Check your YAML syntax.', $id, $name, $attribute, $file));
0 commit comments