diff --git a/src/Application/FinalCallback.php b/src/Application/FinalCallback.php index 0647d843..167c4aa0 100644 --- a/src/Application/FinalCallback.php +++ b/src/Application/FinalCallback.php @@ -77,9 +77,15 @@ public function __invoke(ServerRequestInterface $request) $reflector = new \ReflectionFunction($closure); } - $function[1] = $this->container->arguments($reflector, $function[1]); + /** @var callable */ + $callable = $function[0]; - $this->function = call_user_func_array($function[0], $function[1]); + /** @var array */ + $parameters = $function[1]; + + $parameters = $this->container->arguments($reflector, $parameters); + + $this->function = call_user_func_array($callable, $parameters); return $this->finalize($this->function); } diff --git a/src/Http/HttpIntegration.php b/src/Http/HttpIntegration.php index 1dbb78b2..63984849 100644 --- a/src/Http/HttpIntegration.php +++ b/src/Http/HttpIntegration.php @@ -42,7 +42,7 @@ public function define(ContainerInterface $container, Configuration $config) /** @var array */ $query = $globals[2]; - /** @var array> */ + /** @var array> */ $files = $globals[3]; /** @var array|null|object */ diff --git a/src/Http/ServerRequest.php b/src/Http/ServerRequest.php index b8313c1d..c493eb07 100644 --- a/src/Http/ServerRequest.php +++ b/src/Http/ServerRequest.php @@ -60,7 +60,7 @@ class ServerRequest extends Request implements ServerRequestInterface * @param array $server * @param array $cookies * @param array $query - * @param array> $uploaded + * @param array> $uploaded * @param array|null|object $data * @param array $attributes * @param \Psr\Http\Message\UriInterface|null $uri diff --git a/src/Http/UploadedFile.php b/src/Http/UploadedFile.php index ea065714..0ff95bec 100644 --- a/src/Http/UploadedFile.php +++ b/src/Http/UploadedFile.php @@ -147,24 +147,25 @@ public function moveTo($target) /** * Parses the $_FILES into multiple \File instances. * - * @param array $uploaded + * @param array> $uploaded * @return array */ public static function normalize(array $uploaded) { + $diversed = self::diverse($uploaded); + + /** @var array */ $files = array(); - foreach (self::diverse($uploaded) as $name => $file) + foreach ($diversed as $name => $file) { - list($files[$name], $items) = array($file, array()); + $items = array(); if (! isset($file['name'])) continue; foreach ($file['name'] as $key => $value) { - $instance = self::create($file, $key); - - array_push($items, $instance); + $items[] = self::create($file, $key); } $files[$name] = (array) $items; @@ -176,20 +177,25 @@ public static function normalize(array $uploaded) /** * Creates a new UploadedFile instance. * - * @param array $file - * @param integer $key + * @param array> $file + * @param integer $key * @return \Psr\Http\Message\UploadedFileInterface */ protected static function create(array $file, $key) { + /** @var string */ $tmp = $file['tmp_name'][$key]; + /** @var integer */ $size = $file['size'][$key]; + /** @var integer */ $error = $file['error'][$key]; + /** @var string */ $original = $file['name'][$key]; + /** @var string */ $type = $file['type'][$key]; return new UploadedFile($tmp, $size, $error, $original, $type); @@ -198,8 +204,8 @@ protected static function create(array $file, $key) /** * Diverse the $_FILES into a consistent result. * - * @param array $uploaded - * @return array + * @param array> $uploaded + * @return array> */ protected static function diverse(array $uploaded) { diff --git a/src/Routing/Dispatcher.php b/src/Routing/Dispatcher.php index 6c73912c..a53d63e1 100644 --- a/src/Routing/Dispatcher.php +++ b/src/Routing/Dispatcher.php @@ -136,11 +136,11 @@ protected function parse($httpMethod, $uri, $route) /** * Retrieved the specified route from the result. - * + * * @param array|null> $routes * @param string $uri * @return array - * + * * @throws \UnexpectedValueException */ protected function retrieve(array $routes, $uri)