From fdb1d819096ad428b329aab2d9425aeb5278bd8e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 19 Nov 2023 19:13:07 +0900 Subject: [PATCH] feat: add trigger_error E_USER_DEPRECATED --- system/Filters/Filters.php | 5 +++++ system/Router/RouteCollection.php | 7 +++++++ system/Test/FeatureTestTrait.php | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index 23028d455b94..9bb9cec7f725 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -505,6 +505,11 @@ protected function processMethods() // @deprecated 4.5.0 // @TODO remove this in the future. elseif (array_key_exists(strtolower($method), $this->config->methods)) { + @trigger_error( + 'Setting lowercase HTTP method key "' . $method . '" is deprecated. Use uppercase HTTP method like "GET".', + E_USER_DEPRECATED + ); + $found = true; $method = strtolower($method); } diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 4195631f8ec3..cbf7fc5c2bee 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1012,6 +1012,13 @@ public function match(array $verbs = [], string $from = '', $to = '', ?array $op } foreach ($verbs as $verb) { + if ($verb === strtolower($verb)) { + @trigger_error( + 'Passing lowercase HTTP method "' . $verb . '" is deprecated. Use uppercase HTTP method like "GET".', + E_USER_DEPRECATED + ); + } + /** * @TODO We should use correct uppercase verb. * @deprecated 4.5.0 diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 6e3d4a78fcf0..27606fe47eeb 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -51,6 +51,13 @@ protected function withRoutes(?array $routes = null) $collection->resetRoutes(); foreach ($routes as $route) { + if ($route[0] === strtolower($route[0])) { + @trigger_error( + 'Passing lowercase HTTP method "' . $route[0] . '" is deprecated. Use uppercase HTTP method like "GET".', + E_USER_DEPRECATED + ); + } + /** * @TODO For backward compatibility. Remove strtolower() in the future. * @deprecated 4.5.0