Chris@14: Chris@14: * Chris@14: * For the full copyright and license information, please view the LICENSE Chris@14: * file that was distributed with this source code. Chris@14: */ Chris@14: Chris@14: namespace Symfony\Component\DependencyInjection\Compiler; Chris@14: Chris@17: use Symfony\Component\DependencyInjection\ChildDefinition; Chris@14: use Symfony\Component\DependencyInjection\ContainerBuilder; Chris@14: use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; Chris@14: Chris@14: /** Chris@14: * @author Nicolas Grekas Chris@14: */ Chris@14: class ResolveClassPass implements CompilerPassInterface Chris@14: { Chris@17: private $changes = []; Chris@14: Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: public function process(ContainerBuilder $container) Chris@14: { Chris@14: foreach ($container->getDefinitions() as $id => $definition) { Chris@14: if ($definition->isSynthetic() || null !== $definition->getClass()) { Chris@14: continue; Chris@14: } Chris@14: 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)) { Chris@14: if ($definition instanceof ChildDefinition && !class_exists($id)) { Chris@14: 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)); Chris@14: } Chris@14: $this->changes[strtolower($id)] = $id; Chris@14: $definition->setClass($id); Chris@14: } Chris@14: } Chris@14: } Chris@14: Chris@14: /** Chris@14: * @internal Chris@14: * Chris@14: * @deprecated since 3.3, to be removed in 4.0. Chris@14: */ Chris@14: public function getChanges() Chris@14: { Chris@14: $changes = $this->changes; Chris@17: $this->changes = []; Chris@14: Chris@14: return $changes; Chris@14: } Chris@14: }