Upstream nikic/FastRoute state of the touched files before 8bb83fe8c2

This commit is contained in:
upstream committed 2026-09-04 05:29:02 +02:00
commit c0905f9089
6 files changed
+720

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace FastRoute\Dispatcher;
use FastRoute\Dispatcher\Result\Matched;
use function assert;
use function end;
use function preg_match;
/** @final */
class CharCountBased extends RegexBasedAbstract
{
/** @inheritDoc */
protected function dispatchVariableRoute(array $routeData, string $uri): ?Matched
{
foreach ($routeData as $data) {
assert(isset($data['suffix']));
if (preg_match($data['regex'], $uri . $data['suffix'], $matches) !== 1) {
continue;
}
[$handler, $varNames, $extraParameters] = $data['routeMap'][end($matches)];
$vars = [];
$i = 0;
foreach ($varNames as $varName) {
$vars[$varName] = $matches[++$i];
}
$result = new Matched();
$result->handler = $handler;
$result->variables = $vars;
$result->extraParameters = $extraParameters;
return $result;
}
return null;
}
}