diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-03-02 11:35:32 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-03-02 13:54:59 +0000 |
| commit | cb16e29e5ead96919b74dd4b1e8c8c59353cf770 (patch) | |
| tree | cbb0fea1cebc3ad922c0f8ba0be3359b9b554266 /app/Application.php | |
| parent | f759a528334c4601116e145c062dda5698fe95d0 (diff) | |
| download | webtrees-cb16e29e5ead96919b74dd4b1e8c8c59353cf770.tar.gz webtrees-cb16e29e5ead96919b74dd4b1e8c8c59353cf770.tar.bz2 webtrees-cb16e29e5ead96919b74dd4b1e8c8c59353cf770.zip | |
Error handling
Diffstat (limited to 'app/Application.php')
| -rw-r--r-- | app/Application.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/Application.php b/app/Application.php index 70582390b7..4d79e76e93 100644 --- a/app/Application.php +++ b/app/Application.php @@ -18,6 +18,7 @@ declare(strict_types=1); namespace Fisharebest\Webtrees; use Illuminate\Container\Container; +use ReflectionClass; use ReflectionMethod; use ReflectionParameter; use function array_map; @@ -47,12 +48,22 @@ class Application extends Container /** * @param array $parameters * - * @return array + * @return mixed[] */ private function makeParameters(array $parameters): array { return array_map(function (ReflectionParameter $parameter) { - return $this->make($parameter->getClass()->name); + $class = $parameter->getClass(); + + if ($class instanceof ReflectionClass) { + return $this->make($class->getName()); + } + + if ($parameter->isDefaultValueAvailable()) { + return $parameter->getDefaultValue(); + } + + return null; }, $parameters); } } |
