update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
0
pfosten/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php
vendored
Executable file → Normal file
32
pfosten/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
vendored
Executable file → Normal file
32
pfosten/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
vendored
Executable file → Normal file
|
|
@ -49,16 +49,16 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
|||
{
|
||||
$arguments = array();
|
||||
|
||||
if (is_array($controller)) {
|
||||
if (\is_array($controller)) {
|
||||
$reflection = new \ReflectionMethod($controller[0], $controller[1]);
|
||||
} elseif (is_object($controller) && !$controller instanceof \Closure) {
|
||||
} elseif (\is_object($controller) && !$controller instanceof \Closure) {
|
||||
$reflection = (new \ReflectionObject($controller))->getMethod('__invoke');
|
||||
} else {
|
||||
$reflection = new \ReflectionFunction($controller);
|
||||
}
|
||||
|
||||
foreach ($reflection->getParameters() as $param) {
|
||||
$arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull());
|
||||
$arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param, $reflection), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull());
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
|
|
@ -107,23 +107,35 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
|||
*
|
||||
* @return null|string
|
||||
*/
|
||||
private function getType(\ReflectionParameter $parameter)
|
||||
private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function)
|
||||
{
|
||||
if ($this->supportsParameterType) {
|
||||
if (!$type = $parameter->getType()) {
|
||||
return;
|
||||
}
|
||||
$typeName = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
|
||||
if ('array' === $typeName && !$type->isBuiltin()) {
|
||||
$name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
|
||||
if ('array' === $name && !$type->isBuiltin()) {
|
||||
// Special case for HHVM with variadics
|
||||
return;
|
||||
}
|
||||
|
||||
return $typeName;
|
||||
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $name)) {
|
||||
$name = $name[1];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
$lcName = strtolower($name);
|
||||
|
||||
if (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $info)) {
|
||||
return $info[1];
|
||||
if ('self' !== $lcName && 'parent' !== $lcName) {
|
||||
return $name;
|
||||
}
|
||||
if (!$function instanceof \ReflectionMethod) {
|
||||
return;
|
||||
}
|
||||
if ('self' === $lcName) {
|
||||
return $function->getDeclaringClass()->name;
|
||||
}
|
||||
if ($parent = $function->getDeclaringClass()->getParentClass()) {
|
||||
return $parent->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue