[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Compiler/ -> ResolveClassPass.php (source)

   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\ChildDefinition;
  15  use Symfony\Component\DependencyInjection\ContainerBuilder;
  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 = [];
  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 = [];
  53  
  54          return $changes;
  55      }
  56  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1