Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 6 additions & 38 deletions system/Commands/Utilities/Routes/FilterCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function __construct(
}

/**
* Returns filters for the URI
* Returns filters for the URI based on the HTTP method.
* The HTTP method is compared case-sensitively.
*
* @param string $method HTTP verb like `GET`,`POST` or `CLI`.
* @param string $uri URI path to find filters for
Expand All @@ -46,25 +47,8 @@ public function __construct(
*/
public function get(string $method, string $uri): array
{
if ($method === strtolower($method)) {
@trigger_error(
'Passing lowercase HTTP method "' . $method . '" is deprecated.'
. ' Use uppercase HTTP method like "' . strtoupper($method) . '".',
E_USER_DEPRECATED,
);
}

/**
* @deprecated 4.5.0
* @TODO Remove this in the future.
*/
$method = strtoupper($method);

if ($method === 'CLI') {
return [
'before' => [],
'after' => [],
];
return ['before' => [], 'after' => []];
}

$request = service('incomingrequest', null, false);
Expand All @@ -79,7 +63,8 @@ public function get(string $method, string $uri): array
}

/**
* Returns filter classes for the URI
* Returns filter classes for the URI based on the HTTP method.
* The HTTP method is compared case-sensitively.
*
* @param string $method HTTP verb like `GET`,`POST` or `CLI`.
* @param string $uri URI path to find filters for
Expand All @@ -88,25 +73,8 @@ public function get(string $method, string $uri): array
*/
public function getClasses(string $method, string $uri): array
{
if ($method === strtolower($method)) {
@trigger_error(
'Passing lowercase HTTP method "' . $method . '" is deprecated.'
. ' Use uppercase HTTP method like "' . strtoupper($method) . '".',
E_USER_DEPRECATED,
);
}

/**
* @deprecated 4.5.0
* @TODO Remove this in the future.
*/
$method = strtoupper($method);

if ($method === 'CLI') {
return [
'before' => [],
'after' => [],
];
return ['before' => [], 'after' => []];
}

$request = service('incomingrequest', null, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ public function testGet(): void

$filters = $collector->get(Method::GET, '/');

$expected = [
'before' => [
],
'after' => [
],
];
$this->assertSame($expected, $filters);
$this->assertSame(['before' => [], 'after' => []], $filters);
}
}
2 changes: 2 additions & 0 deletions user_guide_src/source/changelogs/v4.8.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ BREAKING
Behavior Changes
================

- **Commands:** The ``filter:check`` command now requires the HTTP method argument to be uppercase (e.g., ``spark filter:check GET /`` instead of ``spark filter:check get /``).

Interface Changes
=================

Expand Down
Loading