Skip to content

Commit 2df4ef6

Browse files
committed
Some bug improvements.
1 parent 839bc8b commit 2df4ef6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.4.0"
16+
"php": ">=5.5.0"
1717
},
1818
"require-dev": {
1919
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.0",

src/Router.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,14 @@ public function controller($route, $settings, $controller = null)
500500
foreach ($r->getParameters() as $param) {
501501
$pattern = ':any';
502502
$typeHint = $param->hasType() ? $param->getType()->getName() : null;
503-
if ($typeHint === 'int') {
503+
if (in_array($typeHint, ['int', 'bool'])) {
504504
$pattern = ':id';
505-
} elseif ($typeHint === 'string') {
505+
} elseif (in_array($typeHint, ['string', 'float'])) {
506506
$pattern = ':slug';
507+
} elseif ($typeHint === null) {
508+
$pattern = ':any';
509+
} else {
510+
continue;
507511
}
508512
$endpoints[] = $param->isOptional() ? $pattern . '?' : $pattern;
509513
}

0 commit comments

Comments
 (0)