diff -u b/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php --- b/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -112,7 +112,7 @@ * code more self-documenting. * * @param string $route_name - * The name of the route + * The name of the route. * @param array $route_parameters * (optional) An associative array of parameter names and values. * @param array $options @@ -124,7 +124,7 @@ * @todo Update this documentation for non-routed URIs in * https://www.drupal.org/node/2346787 */ - public function __construct($route_name, $route_parameters = [], $options = []) { + public function __construct($route_name, array $route_parameters = [], array $options = []) { $this->routeName = $route_name; $this->routeParameters = $route_parameters; $this->options = $options; @@ -138,7 +138,7 @@ * path (like robots.txt) use Url::fromUri() with the base: scheme. * * @param string $route_name - * The name of the route + * The name of the route. * @param array $route_parameters * (optional) An associative array of route parameter names and values. * @param array $options @@ -150,7 +150,7 @@ * @see \Drupal\Core\Url::fromUserInput() * @see \Drupal\Core\Url::fromUri() */ - public static function fromRoute($route_name, $route_parameters = [], $options = []) { + public static function fromRoute($route_name, array $route_parameters = [], array $options = []) { return new static($route_name, $route_parameters, $options); } @@ -207,7 +207,7 @@ * Thrown when the user input does not begin with one of the following * characters: '/', '?', or '#'. */ - public static function fromUserInput($user_input, $options = []) { + public static function fromUserInput($user_input, array $options = []) { // Ensuring one of these initial characters also enforces that what is // passed is a relative URI reference rather than an absolute URI, // because these are URI reserved characters that a scheme name may not @@ -275,7 +275,7 @@ * @see \Drupal\Core\Url::fromRoute() * @see \Drupal\Core\Url::fromUserInput() */ - public static function fromUri($uri, $options = []) { + public static function fromUri($uri, array $options = []) { // parse_url() incorrectly parses base:number/... as hostname:port/... // and not the scheme. Prevent that by prefixing the path with a slash. if (preg_match('/^base:\d/', $uri)) { @@ -322,7 +322,7 @@ $url = static::fromRouteUri($uri_parts, $uri_options, $uri); } elseif (in_array($uri_parts['scheme'], stream_get_wrappers())) { - $url = static::fromRouteUri($uri_parts, $uri_options, $uri); + $url = static::fromStreamWrapper($uri_parts, $uri_options, $uri); } else { $url = new static($uri, [], $options); @@ -514,11 +514,11 @@ } /** - * Creates a URL + * Creates a URL. */ protected static function fromStreamWrapper($uri_parts, $uri_options, $uri) { } - + /** * Generates a URI string that represents the data in the Url object. * @@ -606,7 +606,7 @@ * @throws \UnexpectedValueException. * If this is a URI with no corresponding route. */ - public function setRouteParameters($parameters) { + public function setRouteParameters(array $parameters) { if ($this->unrouted) { throw new \UnexpectedValueException('External URLs do not have route parameters.'); } @@ -674,7 +674,7 @@ * * @return $this */ - public function setOptions($options) { + public function setOptions(array $options) { $this->options = $options; return $this; } @@ -708,7 +708,7 @@ * * @return $this */ - public function mergeOptions($options) { + public function mergeOptions(array $options) { $this->options = NestedArray::mergeDeep($this->options, $options); return $this; }