Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
46 if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { | 46 if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { |
47 if ($definition->getFactory()) { | 47 if ($definition->getFactory()) { |
48 throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); | 48 throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); |
49 } | 49 } |
50 if (class_exists($id) || interface_exists($id, false)) { | 50 if (class_exists($id) || interface_exists($id, false)) { |
51 if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) { | |
52 throw new RuntimeException(sprintf( | |
53 'The definition for "%s" has no class attribute, and appears to reference a class or interface. ' | |
54 .'Please specify the class attribute explicitly or remove the leading backslash by renaming ' | |
55 .'the service to "%s" to get rid of this error.', | |
56 $id, substr($id, 1) | |
57 )); | |
58 } | |
59 | |
51 throw new RuntimeException(sprintf( | 60 throw new RuntimeException(sprintf( |
52 'The definition for "%s" has no class attribute, and appears to reference a ' | 61 'The definition for "%s" has no class attribute, and appears to reference a ' |
53 .'class or interface in the global namespace. Leaving out the "class" attribute ' | 62 .'class or interface in the global namespace. Leaving out the "class" attribute ' |
54 .'is only allowed for namespaced classes. Please specify the class attribute ' | 63 .'is only allowed for namespaced classes. Please specify the class attribute ' |
55 .'explicitly to get rid of this error.', | 64 .'explicitly to get rid of this error.', |
56 $id | 65 $id |
57 )); | 66 )); |
58 } | 67 } |
59 | 68 |
60 throw new RuntimeException(sprintf( | 69 throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); |
61 'The definition for "%s" has no class. If you intend to inject ' | |
62 .'this service dynamically at runtime, please mark it as synthetic=true. ' | |
63 .'If this is an abstract definition solely used by child definitions, ' | |
64 .'please add abstract=true, otherwise specify a class to get rid of this error.', | |
65 $id | |
66 )); | |
67 } | 70 } |
68 | 71 |
69 // tag attribute values must be scalars | 72 // tag attribute values must be scalars |
70 foreach ($definition->getTags() as $name => $tags) { | 73 foreach ($definition->getTags() as $name => $tags) { |
71 foreach ($tags as $attributes) { | 74 foreach ($tags as $attributes) { |
78 } | 81 } |
79 | 82 |
80 if ($definition->isPublic() && !$definition->isPrivate()) { | 83 if ($definition->isPublic() && !$definition->isPrivate()) { |
81 $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); | 84 $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); |
82 if (null !== $usedEnvs) { | 85 if (null !== $usedEnvs) { |
83 throw new EnvParameterException(array($resolvedId), null, 'A service name ("%s") cannot contain dynamic values.'); | 86 throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); |
84 } | 87 } |
85 } | 88 } |
86 } | 89 } |
87 | 90 |
88 foreach ($container->getAliases() as $id => $alias) { | 91 foreach ($container->getAliases() as $id => $alias) { |
89 if ($alias->isPublic() && !$alias->isPrivate()) { | 92 if ($alias->isPublic() && !$alias->isPrivate()) { |
90 $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); | 93 $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); |
91 if (null !== $usedEnvs) { | 94 if (null !== $usedEnvs) { |
92 throw new EnvParameterException(array($resolvedId), null, 'An alias name ("%s") cannot contain dynamic values.'); | 95 throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); |
93 } | 96 } |
94 } | 97 } |
95 } | 98 } |
96 } | 99 } |
97 } | 100 } |