Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mundschenk-at committed Mar 12, 2021
1 parent 27ddf01 commit 0528175
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dice.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ private function getParams(\ReflectionMethod $method, array $rule) {
//Find a match in $args for scalar types
else if ($args && $param->getType()) {
for ($i = 0; $i < count($args); $i++) {
if (call_user_func('is_' . $param->getType()->getName(), $args[$i])) {
// Support both PHP 7.0 and later versions without deprecations - see https://github.com/Level-2/Dice/issues/189
$param_type_name = PHP_VERSION_ID < 70100 ? $param->getType()->__toString() : $param->getType()->getName();
if (call_user_func("is_{$param_type_name}", $args[$i])) {
$parameters[] = array_splice($args, $i, 1)[0];
break; // Fixes incorrect parameter order introduced in 4.0.2 - see https://github.com/Level-2/Dice/issues/181
}
Expand Down

0 comments on commit 0528175

Please sign in to comment.