Browse Source

Better method signatures for Routing.

euromark 11 years ago
parent
commit
203de9f8e4
3 changed files with 5 additions and 5 deletions
  1. 2 2
      src/Routing/RouteBuilder.php
  2. 1 1
      src/Routing/RouteCollection.php
  3. 2 2
      src/Routing/Router.php

+ 2 - 2
src/Routing/RouteBuilder.php

@@ -219,7 +219,7 @@ class RouteBuilder {
  * - 'actions' - Override the method names used for connecting actions.
  *
  * @param string $name A controller name to connect resource routes for.
- * @param array $options Options to use when generating REST routes
+ * @param array|callable $options Options to use when generating REST routes
  * @param callable $callback An optional callback to be executed in a nested scope. Nested
  *   scopes inherit the existing path and 'id' parameter.
  * @return array Array of mapped resources
@@ -440,7 +440,7 @@ class RouteBuilder {
  *   shifted into the passed arguments. As well as supplying patterns for routing parameters.
  * @return array Array of routes
  */
-	public function redirect($route, $url, $options = []) {
+	public function redirect($route, $url, array $options = []) {
 		$options['routeClass'] = 'Cake\Routing\Route\RedirectRoute';
 		if (is_string($url)) {
 			$url = array('redirect' => $url);

+ 1 - 1
src/Routing/RouteCollection.php

@@ -74,7 +74,7 @@ class RouteCollection {
  *   `_name` option, which enables named routes.
  * @return void
  */
-	public function add(Route $route, $options = []) {
+	public function add(Route $route, array $options = []) {
 		$this->_routes[] = $route;
 
 		// Explicit names

+ 2 - 2
src/Routing/Router.php

@@ -756,7 +756,7 @@ class Router {
  * @param array $options The array of options.
  * @return \Cake\Network\Request The modified request
  */
-	public static function parseNamedParams(Request $request, $options = []) {
+	public static function parseNamedParams(Request $request, array $options = []) {
 		$options += array('separator' => ':');
 		if (empty($request->params['pass'])) {
 			$request->params['named'] = [];
@@ -829,7 +829,7 @@ class Router {
  * @return null|\Cake\Routing\RouteBuilder The route builder
  *   was created/used.
  */
-	public static function scope($path, $params = [], $callback = null) {
+	public static function scope($path, array $params = [], $callback = null) {
 		$builder = new RouteBuilder(static::$_collection, '/', [], [
 			'routeClass' => static::defaultRouteClass(),
 			'extensions' => static::$_collection->extensions()