@@ -348,7 +348,7 @@ public static function form(string $url, $callback, array $settings = null): IRo
348
348
* @param array|null $settings
349
349
* @return RouteUrl|IRoute
350
350
*/
351
- public static function match (array $ requestMethods , string $ url , $ callback , array $ settings = null )
351
+ public static function match (array $ requestMethods , string $ url , $ callback , array $ settings = null ): IRoute
352
352
{
353
353
$ route = new RouteUrl ($ url , $ callback );
354
354
$ route ->setRequestMethods ($ requestMethods );
@@ -368,7 +368,7 @@ public static function match(array $requestMethods, string $url, $callback, arra
368
368
* @param array|null $settings
369
369
* @return RouteUrl|IRoute
370
370
*/
371
- public static function all (string $ url , $ callback , array $ settings = null )
371
+ public static function all (string $ url , $ callback , array $ settings = null ): IRoute
372
372
{
373
373
$ route = new RouteUrl ($ url , $ callback );
374
374
@@ -387,7 +387,7 @@ public static function all(string $url, $callback, array $settings = null)
387
387
* @param array|null $settings
388
388
* @return RouteController|IRoute
389
389
*/
390
- public static function controller (string $ url , string $ controller , array $ settings = null )
390
+ public static function controller (string $ url , string $ controller , array $ settings = null ): IRoute
391
391
{
392
392
$ route = new RouteController ($ url , $ controller );
393
393
@@ -406,7 +406,7 @@ public static function controller(string $url, string $controller, array $settin
406
406
* @param array|null $settings
407
407
* @return RouteResource|IRoute
408
408
*/
409
- public static function resource (string $ url , string $ controller , array $ settings = null )
409
+ public static function resource (string $ url , string $ controller , array $ settings = null ): IRoute
410
410
{
411
411
$ route = new RouteResource ($ url , $ controller );
412
412
@@ -512,20 +512,7 @@ public static function router(): Router
512
512
public static function addDefaultNamespace (IRoute $ route ): IRoute
513
513
{
514
514
if (static ::$ defaultNamespace !== null ) {
515
-
516
- $ ns = static ::$ defaultNamespace ;
517
- $ namespace = $ route ->getNamespace ();
518
-
519
- if ($ namespace !== null ) {
520
- // Don't overwrite namespaces that starts with \
521
- if ($ namespace [0 ] !== '\\' ) {
522
- $ ns .= '\\' . $ namespace ;
523
- } else {
524
- $ ns = $ namespace ;
525
- }
526
- }
527
-
528
- $ route ->setNamespace ($ ns );
515
+ $ route ->setNamespace (static ::$ defaultNamespace );
529
516
}
530
517
531
518
return $ route ;
0 commit comments