You are here

private function ProxyGenerator::getParameterType in Plug 7

Parameters

ClassMetadata $class:

\ReflectionMethod $method:

\ReflectionParameter $parameter:

Return value

string|null

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

File

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

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;
}