You are here

private function ProxyGenerator::getParameterType in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php \Doctrine\Common\Proxy\ProxyGenerator::getParameterType()

Parameters

ClassMetadata $class:

\ReflectionMethod $method:

\ReflectionParameter $parameter:

Return value

string|null

1 call to ProxyGenerator::getParameterType()
ProxyGenerator::buildParametersString in vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php

File

vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php, line 937

Class

ProxyGenerator
This factory is used to generate proxy classes. It builds proxies from given parameters, a template and class metadata.

Namespace

Doctrine\Common\Proxy

Code

private function getParameterType(ClassMetadata $class, \ReflectionMethod $method, \ReflectionParameter $parameter) {

  // We need to pick the type hint class too
  if ($parameter
    ->isArray()) {
    return 'array';
  }
  if (method_exists($parameter, 'isCallable') && $parameter
    ->isCallable()) {
    return 'callable';
  }
  try {
    $parameterClass = $parameter
      ->getClass();
    if ($parameterClass) {
      return '\\' . $parameterClass
        ->getName();
    }
  } catch (\ReflectionException $previous) {
    throw UnexpectedValueException::invalidParameterTypeHint($class
      ->getName(), $method
      ->getName(), $parameter
      ->getName(), $previous);
  }
  return null;
}