From 941149d8d727fa232519188be9ecea0ddccb6db7 Mon Sep 17 00:00:00 2001 From: sessingo Date: Sat, 11 Feb 2023 17:31:00 +0100 Subject: [PATCH] Fixed deprication warnings --- .github/workflows/ci.yml | 2 +- composer.json | 2 +- src/Pecee/SimpleRouter/Route/LoadableRoute.php | 2 +- src/Pecee/SimpleRouter/Route/RouteController.php | 2 +- src/Pecee/SimpleRouter/Route/RouteGroup.php | 2 +- src/Pecee/SimpleRouter/Route/RouteResource.php | 2 +- src/Pecee/SimpleRouter/Router.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df8d15f..f6a9566 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - 7.4 - 8.0 phpunit-version: - - 7.5.20 + - 8.5.32 dependencies: - lowest - highest diff --git a/composer.json b/composer.json index ed6c021..5efc832 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^7", + "phpunit/phpunit": "^8", "mockery/mockery": "^1", "phpstan/phpstan": "^0", "phpstan/phpstan-phpunit": "^0", diff --git a/src/Pecee/SimpleRouter/Route/LoadableRoute.php b/src/Pecee/SimpleRouter/Route/LoadableRoute.php index 9ef4fe7..0996b24 100644 --- a/src/Pecee/SimpleRouter/Route/LoadableRoute.php +++ b/src/Pecee/SimpleRouter/Route/LoadableRoute.php @@ -167,7 +167,7 @@ abstract class LoadableRoute extends Route implements ILoadableRoute if (stripos($url, $param1) !== false || stripos($url, $param) !== false) { /* Add parameter to the correct position */ - $url = str_ireplace([sprintf($param1, $param), sprintf($param2, $param)], $value, $url); + $url = str_ireplace([sprintf($param1, $param), sprintf($param2, $param)], (string)$value, $url); } else { /* Parameter aren't recognized and will be appended at the end of the url */ $url .= $value . '/'; diff --git a/src/Pecee/SimpleRouter/Route/RouteController.php b/src/Pecee/SimpleRouter/Route/RouteController.php index 88c6597..c80299e 100644 --- a/src/Pecee/SimpleRouter/Route/RouteController.php +++ b/src/Pecee/SimpleRouter/Route/RouteController.php @@ -81,7 +81,7 @@ class RouteController extends LoadableRoute implements IControllerRoute $url .= '//' . $group->getDomains()[0]; } - $url .= '/' . trim($this->getUrl(), '/') . '/' . strtolower($method) . implode('/', $parameters); + $url .= '/' . trim($this->getUrl(), '/') . '/' . strtolower((string)$method) . implode('/', $parameters); return '/' . trim($url, '/') . '/'; } diff --git a/src/Pecee/SimpleRouter/Route/RouteGroup.php b/src/Pecee/SimpleRouter/Route/RouteGroup.php index 71b650b..a840784 100644 --- a/src/Pecee/SimpleRouter/Route/RouteGroup.php +++ b/src/Pecee/SimpleRouter/Route/RouteGroup.php @@ -74,7 +74,7 @@ class RouteGroup extends Route implements IGroupRoute $parsedPrefix = $this->prefix; foreach ($this->getParameters() as $parameter => $value) { - $parsedPrefix = str_ireplace('{' . $parameter . '}', $value, $parsedPrefix); + $parsedPrefix = str_ireplace('{' . $parameter . '}', (string)$value, (string)$parsedPrefix); } /* Skip if prefix doesn't match */ diff --git a/src/Pecee/SimpleRouter/Route/RouteResource.php b/src/Pecee/SimpleRouter/Route/RouteResource.php index f8be0b7..587fd10 100644 --- a/src/Pecee/SimpleRouter/Route/RouteResource.php +++ b/src/Pecee/SimpleRouter/Route/RouteResource.php @@ -106,7 +106,7 @@ class RouteResource extends LoadableRoute implements IControllerRoute return false; } - $action = strtolower(trim($this->parameters['action'])); + $action = strtolower(trim((string)$this->parameters['action'])); $id = $this->parameters['id']; // Remove action parameter diff --git a/src/Pecee/SimpleRouter/Router.php b/src/Pecee/SimpleRouter/Router.php index 509ca2a..8a66ae1 100644 --- a/src/Pecee/SimpleRouter/Router.php +++ b/src/Pecee/SimpleRouter/Router.php @@ -608,7 +608,7 @@ class Router if (strpos($name, '@') !== false) { [$controller, $method] = array_map('strtolower', explode('@', $name)); - if ($controller === strtolower($route->getClass()) && $method === strtolower($route->getMethod())) { + if ($controller === strtolower((string)$route->getClass()) && $method === strtolower((string)$route->getMethod())) { $this->debug('Found route "%s" by controller "%s" and method "%s"', $route->getUrl(), $controller, $method); return $route;