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

Breadcrumb

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

function Reflection::getParameterClassName

Gets the parameter's class name.

Parameters

\ReflectionParameter $parameter: The parameter.

Return value

string|null The parameter's class name or NULL if the parameter is not a class.

3 calls to Reflection::getParameterClassName()
ArgumentsResolver::getArgument in core/lib/Drupal/Component/Utility/ArgumentsResolver.php
Gets the argument value for a parameter.
EntityResolverManager::setParametersFromReflection in core/lib/Drupal/Core/Entity/EntityResolverManager.php
Sets the upcasting information using reflection.
TaggedHandlersPass::processServiceCollectorPass in core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php
Processes a service collector service pass.

File

core/lib/Drupal/Component/Utility/Reflection.php, line 19

Class

Reflection
Provides helper methods for reflection.

Namespace

Drupal\Component\Utility

Code

public static function getParameterClassName(\ReflectionParameter $parameter) : ?string {
    $name = NULL;
    if ($parameter->hasType() && !$parameter->getType()
        ->isBuiltin()) {
        $name = $parameter->getType()
            ->getName();
        $lc_name = strtolower($name);
        switch ($lc_name) {
            case 'self':
                return $parameter->getDeclaringClass()
                    ->getName();
            case 'parent':
                return ($parent = $parameter->getDeclaringClass()
                    ->getParentClass()) ? $parent->name : NULL;
        }
    }
    return $name;
}

API Navigation

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