Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ArgumentMetadataFactory.php

function ArgumentMetadataFactory::createArgumentMetadata

Overrides ArgumentMetadataFactoryInterface::createArgumentMetadata

File

vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php, line 21

Class

ArgumentMetadataFactory
Builds { @author Iltar van der Berg <kjarli@gmail.com>

Namespace

Symfony\Component\HttpKernel\ControllerMetadata

Code

public function createArgumentMetadata(string|object|array $controller, ?\ReflectionFunctionAbstract $reflector = null) : array {
    $arguments = [];
    $reflector ??= new \ReflectionFunction($controller(...));
    $controllerName = $this->getPrettyName($reflector);
    foreach ($reflector->getParameters() as $param) {
        $attributes = [];
        foreach ($param->getAttributes() as $reflectionAttribute) {
            if (class_exists($reflectionAttribute->getName())) {
                $attributes[] = $reflectionAttribute->newInstance();
            }
        }
        $arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param), $param->isVariadic(), $param->isDefaultValueAvailable(), $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null, $param->allowsNull(), $attributes, $controllerName);
    }
    return $arguments;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal