Skip to content
Permalink
Browse files

Route, SimpleRouter: flags is deprecated

  • Loading branch information
dg committed Mar 10, 2020
1 parent acda0f3 commit c2c41c28f012da670a28bad15c50fa8549e08eae
Showing with 11 additions and 7 deletions.
  1. +6 −3 src/Application/Routers/Route.php
  2. +4 −3 src/Application/Routers/SimpleRouter.php
  3. +1 −1 tests/Routers/Route.oneWay.phpt
@@ -66,6 +66,10 @@ public function __construct(string $mask, $metadata = [], int $flags = 0)
];
}

if ($flags) {
trigger_error(__METHOD__ . '() parameter $flags is deprecated, use RouteList::add(..., $flags) instead.', E_USER_DEPRECATED);
}

$this->defaultMeta = $this->defaultMeta + self::UI_META;
$this->flags = $flags;
parent::__construct($mask, $metadata);
@@ -141,11 +145,10 @@ public function getConstantParameters(): array
}


/**
* Returns flags.
*/
/** @deprecated */
public function getFlags(): int
{
trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED);
return $this->flags;
}

@@ -41,6 +41,8 @@ public function __construct($defaults = [], int $flags = 0)

if (isset($defaults[self::MODULE_KEY])) {
throw new Nette\DeprecatedException(__METHOD__ . '() parameter module is deprecated, use RouteList::withModule() instead.');
} elseif ($flags) {
trigger_error(__METHOD__ . '() parameter $flags is deprecated, use RouteList::add(..., $flags) instead.', E_USER_DEPRECATED);
}

$this->flags = $flags;
@@ -60,11 +62,10 @@ public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?stri
}


/**
* Returns flags.
*/
/** @deprecated */
public function getFlags(): int
{
trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED);
return $this->flags;
}
}
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/Route.php';


$route = new Route('<presenter>/<action>', [
@$route = new Route('<presenter>/<action>', [ // @ is deprecated
'presenter' => 'Default',
'action' => 'default',
], Route::ONE_WAY);

0 comments on commit c2c41c2

Please sign in to comment.
You can’t perform that action at this time.