diff --git a/src/Application/IRouter.php b/src/Application/IRouter.php index 1c0fc4db7..b5695c055 100644 --- a/src/Application/IRouter.php +++ b/src/Application/IRouter.php @@ -18,7 +18,7 @@ interface IRouter /** only matching route */ const ONE_WAY = 0b0001; - /** HTTPS route */ + /** @deprecated */ const SECURED = 0b0010; /** diff --git a/src/Application/Routers/Route.php b/src/Application/Routers/Route.php index ae36e84cc..0285a65dd 100644 --- a/src/Application/Routers/Route.php +++ b/src/Application/Routers/Route.php @@ -41,7 +41,7 @@ class Route implements Application\IRouter PATH_OPTIONAL = 1, CONSTANT = 2; - /** @var int */ + /** @deprecated */ public static $defaultFlags = 0; /** @var array */ @@ -132,6 +132,11 @@ public function __construct($mask, $metadata = [], $flags = 0) ]; } + if (static::$defaultFlags) { + trigger_error('Route::$defaultFlags is deprecated, router by default keeps the used protocol.', E_USER_DEPRECATED); + } elseif ($flags & self::SECURED) { + trigger_error('IRouter::SECURED is deprecated, router by default keeps the used protocol.', E_USER_DEPRECATED); + } $this->flags = $flags | static::$defaultFlags; $this->setMask($mask, $metadata); } diff --git a/src/Application/Routers/SimpleRouter.php b/src/Application/Routers/SimpleRouter.php index 1a34c79a4..1a1df2ed2 100644 --- a/src/Application/Routers/SimpleRouter.php +++ b/src/Application/Routers/SimpleRouter.php @@ -55,6 +55,9 @@ public function __construct($defaults = [], $flags = 0) $this->defaults = $defaults; $this->flags = $flags; + if ($flags & self::SECURED) { + trigger_error('IRouter::SECURED is deprecated, router by default keeps the used protocol.', E_USER_DEPRECATED); + } } diff --git a/tests/Routers/Route.secured.phpt b/tests/Routers/Route.secured.phpt index 931e75506..402e2ad32 100644 --- a/tests/Routers/Route.secured.phpt +++ b/tests/Routers/Route.secured.phpt @@ -13,7 +13,7 @@ require __DIR__ . '/../bootstrap.php'; require __DIR__ . '/Route.php'; -$route = new Route('', [ +$route = @new Route('', [ // @ SECURED is deprecated 'presenter' => 'Presenter', ], Route::SECURED); diff --git a/tests/Routers/SimpleRouter.secured.phpt b/tests/Routers/SimpleRouter.secured.phpt index 554d6c8de..7607c199e 100644 --- a/tests/Routers/SimpleRouter.secured.phpt +++ b/tests/Routers/SimpleRouter.secured.phpt @@ -12,7 +12,7 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; -$router = new Application\Routers\SimpleRouter([ +$router = @new Application\Routers\SimpleRouter([ // @ SECURED is deprecated 'id' => 12, 'any' => 'anyvalue', ], Application\Routers\SimpleRouter::SECURED);