4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Compiler;
14 use Symfony\Component\DependencyInjection\Definition;
15 use Symfony\Component\DependencyInjection\Exception\RuntimeException;
18 * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
20 class ResolveFactoryClassPass extends AbstractRecursivePass
25 protected function processValue($value, $isRoot = false)
27 if ($value instanceof Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) {
28 if (null === $class = $value->getClass()) {
29 throw new RuntimeException(sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId));
33 $value->setFactory($factory);
36 return parent::processValue($value, $isRoot);