Skip to content

Commit

Permalink
Update DependencyBuilder.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Idrinth authored Jul 20, 2023
1 parent 74a3170 commit 64e2a27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/DependencyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ private function getParamValue(ReflectionParameter $param, array $variables, str
default => (string)$this->environment[$key],
};
}
if (isset($this->environment[$param->getName()])) {
return match ($param->getType()->getName()) {
'int' => (int)$this->environment[$param->getName()],
'float' => (float)$this->environment[$param->getName()],
'bool' => $this->environment[$param->getName()] === 'true',
'array' => explode(',', $this->environment[$param->getName()]),
default => (string)$this->environment[$param->getName()],
};
}
if ($type->allowsNull()) {
return null;
}
Expand Down

0 comments on commit 64e2a27

Please sign in to comment.