mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 11:12:16 +00:00
Fixed deprication warnings
This commit is contained in:
@@ -20,7 +20,7 @@ jobs:
|
|||||||
- 7.4
|
- 7.4
|
||||||
- 8.0
|
- 8.0
|
||||||
phpunit-version:
|
phpunit-version:
|
||||||
- 7.5.20
|
- 8.5.32
|
||||||
dependencies:
|
dependencies:
|
||||||
- lowest
|
- lowest
|
||||||
- highest
|
- highest
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
"ext-json": "*"
|
"ext-json": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^7",
|
"phpunit/phpunit": "^8",
|
||||||
"mockery/mockery": "^1",
|
"mockery/mockery": "^1",
|
||||||
"phpstan/phpstan": "^0",
|
"phpstan/phpstan": "^0",
|
||||||
"phpstan/phpstan-phpunit": "^0",
|
"phpstan/phpstan-phpunit": "^0",
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
|||||||
|
|
||||||
if (stripos($url, $param1) !== false || stripos($url, $param) !== false) {
|
if (stripos($url, $param1) !== false || stripos($url, $param) !== false) {
|
||||||
/* Add parameter to the correct position */
|
/* 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 {
|
} else {
|
||||||
/* Parameter aren't recognized and will be appended at the end of the url */
|
/* Parameter aren't recognized and will be appended at the end of the url */
|
||||||
$url .= $value . '/';
|
$url .= $value . '/';
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class RouteController extends LoadableRoute implements IControllerRoute
|
|||||||
$url .= '//' . $group->getDomains()[0];
|
$url .= '//' . $group->getDomains()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$url .= '/' . trim($this->getUrl(), '/') . '/' . strtolower($method) . implode('/', $parameters);
|
$url .= '/' . trim($this->getUrl(), '/') . '/' . strtolower((string)$method) . implode('/', $parameters);
|
||||||
|
|
||||||
return '/' . trim($url, '/') . '/';
|
return '/' . trim($url, '/') . '/';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class RouteGroup extends Route implements IGroupRoute
|
|||||||
$parsedPrefix = $this->prefix;
|
$parsedPrefix = $this->prefix;
|
||||||
|
|
||||||
foreach ($this->getParameters() as $parameter => $value) {
|
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 */
|
/* Skip if prefix doesn't match */
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class RouteResource extends LoadableRoute implements IControllerRoute
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = strtolower(trim($this->parameters['action']));
|
$action = strtolower(trim((string)$this->parameters['action']));
|
||||||
$id = $this->parameters['id'];
|
$id = $this->parameters['id'];
|
||||||
|
|
||||||
// Remove action parameter
|
// Remove action parameter
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ class Router
|
|||||||
if (strpos($name, '@') !== false) {
|
if (strpos($name, '@') !== false) {
|
||||||
[$controller, $method] = array_map('strtolower', explode('@', $name));
|
[$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);
|
$this->debug('Found route "%s" by controller "%s" and method "%s"', $route->getUrl(), $controller, $method);
|
||||||
|
|
||||||
return $route;
|
return $route;
|
||||||
|
|||||||
Reference in New Issue
Block a user