Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

RemoveEmptyControllerArgumentLocatorsPass.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 2.88 KiB


 01  <?php
 02   
 03  /*
 04   * This file is part of the Symfony package.
 05   *
 06   * (c) Fabien Potencier <fabien@symfony.com>
 07   *
 08   * For the full copyright and license information, please view the LICENSE
 09   * file that was distributed with this source code.
 10   */
 11   
 12  namespace Symfony\Component\HttpKernel\DependencyInjection;
 13   
 14  use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
 15  use Symfony\Component\DependencyInjection\ContainerBuilder;
 16   
 17  /**
 18   * Removes empty service-locators registered for ServiceValueResolver.
 19   *
 20   * @author Nicolas Grekas <p@tchwork.com>
 21   */
 22  class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
 23  {
 24      private $resolverServiceId;
 25   
 26      public function __construct($resolverServiceId = 'argument_resolver.service')
 27      {
 28          $this->resolverServiceId = $resolverServiceId;
 29      }
 30   
 31      public function process(ContainerBuilder $container)
 32      {
 33          if (false === $container->hasDefinition($this->resolverServiceId)) {
 34              return;
 35          }
 36   
 37          $serviceResolver = $container->getDefinition($this->resolverServiceId);
 38          $controllerLocator = $container->getDefinition((string) $serviceResolver->getArgument(0));
 39          $controllers = $controllerLocator->getArgument(0);
 40   
 41          foreach ($controllers as $controller => $argumentRef) {
 42              $argumentLocator = $container->getDefinition((string) $argumentRef->getValues()[0]);
 43   
 44              if (!$argumentLocator->getArgument(0)) {
 45                  // remove empty argument locators
 46                  $reason = sprintf('Removing service-argument resolver for controller "%s": no corresponding services exist for the referenced types.', $controller);
 47              } else {
 48                  // any methods listed for call-at-instantiation cannot be actions
 49                  $reason = false;
 50                  $action = substr(strrchr($controller, ':'), 1);
 51                  $id = substr($controller, 0, -1 - \strlen($action));
 52                  $controllerDef = $container->getDefinition($id);
 53                  foreach ($controllerDef->getMethodCalls() as list($method)) {
 54                      if (0 === strcasecmp($action, $method)) {
 55                          $reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id);
 56                          break;
 57                      }
 58                  }
 59                  if (!$reason) {
 60                      if ($controllerDef->getClass() === $id) {
 61                          $controllers[$id.'::'.$action] = $argumentRef;
 62                      }
 63                      if ('__invoke' === $action) {
 64                          $controllers[$id] = $argumentRef;
 65                      }
 66                      continue;
 67                  }
 68              }
 69   
 70              unset($controllers[$controller]);
 71              $container->log($this, $reason);
 72          }
 73   
 74          $controllerLocator->replaceArgument(0, $controllers);
 75      }
 76  }
 77