comparison vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\DependencyInjection\Compiler;
13
14 use Symfony\Component\DependencyInjection\ContainerBuilder;
15 use Symfony\Component\DependencyInjection\ChildDefinition;
16 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
17
18 /**
19 * @author Nicolas Grekas <p@tchwork.com>
20 */
21 class ResolveClassPass implements CompilerPassInterface
22 {
23 private $changes = array();
24
25 /**
26 * {@inheritdoc}
27 */
28 public function process(ContainerBuilder $container)
29 {
30 foreach ($container->getDefinitions() as $id => $definition) {
31 if ($definition->isSynthetic() || null !== $definition->getClass()) {
32 continue;
33 }
34 if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) {
35 if ($definition instanceof ChildDefinition && !class_exists($id)) {
36 throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id));
37 }
38 $this->changes[strtolower($id)] = $id;
39 $definition->setClass($id);
40 }
41 }
42 }
43
44 /**
45 * @internal
46 *
47 * @deprecated since 3.3, to be removed in 4.0.
48 */
49 public function getChanges()
50 {
51 $changes = $this->changes;
52 $this->changes = array();
53
54 return $changes;
55 }
56 }