Tomas Votruba a23b777a9a Updated Rector to commit 3a96b9097d6fbc29085210f2d85dd5d95755ef31
3a96b9097d [DeadCode] Skip fluent return  on RemoveEmptyMethodCallRector (#521)
2021-07-27 11:16:44 +00:00

40 lines
1.9 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix20210727\Symfony\Component\DependencyInjection\Compiler;
use RectorPrefix20210727\Symfony\Component\DependencyInjection\ChildDefinition;
use RectorPrefix20210727\Symfony\Component\DependencyInjection\ContainerBuilder;
use RectorPrefix20210727\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class ResolveClassPass implements \RectorPrefix20210727\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
{
/**
* {@inheritdoc}
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
public function process($container)
{
foreach ($container->getDefinitions() as $id => $definition) {
if ($definition->isSynthetic() || null !== $definition->getClass()) {
continue;
}
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)) {
if ($definition instanceof \RectorPrefix20210727\Symfony\Component\DependencyInjection\ChildDefinition && !\class_exists($id)) {
throw new \RectorPrefix20210727\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Service definition "%s" has a parent but no class, and its name looks like an 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));
}
$definition->setClass($id);
}
}
}
}