Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\DependencyInjection\Compiler; Chris@0: Chris@17: use Symfony\Component\DependencyInjection\ContainerInterface; Chris@0: use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; Chris@0: use Symfony\Component\DependencyInjection\Reference; Chris@0: Chris@0: /** Chris@0: * Checks that all references are pointing to a valid service. Chris@0: * Chris@0: * @author Johannes M. Schmitt Chris@0: */ Chris@14: class CheckExceptionOnInvalidReferenceBehaviorPass extends AbstractRecursivePass Chris@0: { Chris@14: protected function processValue($value, $isRoot = false) Chris@14: { Chris@14: if (!$value instanceof Reference) { Chris@14: return parent::processValue($value, $isRoot); Chris@14: } Chris@14: if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && !$this->container->has($id = (string) $value)) { Chris@14: throw new ServiceNotFoundException($id, $this->currentId); Chris@14: } Chris@0: Chris@14: return $value; Chris@0: } Chris@0: }