Skip to content

Commit 375c340

Browse files
committed
feat: add trigger_error E_USER_DEPRECATED
1 parent cb35ef7 commit 375c340

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

system/Filters/Filters.php

+6
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,12 @@ protected function processMethods()
505505
// @deprecated 4.5.0
506506
// @TODO remove this in the future.
507507
elseif (array_key_exists(strtolower($method), $this->config->methods)) {
508+
@trigger_error(
509+
'Setting lowercase HTTP method key "' . strtolower($method) . '" is deprecated.'
510+
. ' Use uppercase HTTP method like "' . strtoupper($method) . '".',
511+
E_USER_DEPRECATED
512+
);
513+
508514
$found = true;
509515
$method = strtolower($method);
510516
}

system/Router/RouteCollection.php

+8
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,14 @@ public function match(array $verbs = [], string $from = '', $to = '', ?array $op
10121012
}
10131013

10141014
foreach ($verbs as $verb) {
1015+
if ($verb === strtolower($verb)) {
1016+
@trigger_error(
1017+
'Passing lowercase HTTP method "' . $verb . '" is deprecated.'
1018+
. ' Use uppercase HTTP method like "' . strtoupper($verb) . '".',
1019+
E_USER_DEPRECATED
1020+
);
1021+
}
1022+
10151023
/**
10161024
* @TODO We should use correct uppercase verb.
10171025
* @deprecated 4.5.0

system/Test/FeatureTestTrait.php

+8
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ protected function withRoutes(?array $routes = null)
5151
$collection->resetRoutes();
5252

5353
foreach ($routes as $route) {
54+
if ($route[0] === strtolower($route[0])) {
55+
@trigger_error(
56+
'Passing lowercase HTTP method "' . $route[0] . '" is deprecated.'
57+
. ' Use uppercase HTTP method like "' . strtoupper($route[0]) . '".',
58+
E_USER_DEPRECATED
59+
);
60+
}
61+
5462
/**
5563
* @TODO For backward compatibility. Remove strtolower() in the future.
5664
* @deprecated 4.5.0

0 commit comments

Comments
 (0)