Skip to content

Commit 76642be

Browse files
authored
Prevent fatal errors in app() helper on PHP 8.5 (#185)
2 parents 71c11be + 4105e8a commit 76642be

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Phaseolies/Helpers/helpers.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,17 @@ function dopparEnv(string $key, string|float|int|bool|null $default = null): str
6060
*/
6161
function app($abstract = null, array $parameters = [])
6262
{
63+
$container = Container::getInstance();
64+
6365
if (is_null($abstract)) {
64-
return Container::getInstance();
66+
return $container;
67+
}
68+
69+
if (!$container->has($abstract)) {
70+
return null;
6571
}
6672

67-
return Container::getInstance()->get($abstract, $parameters);
73+
return $container->get($abstract, $parameters);
6874
}
6975
}
7076

0 commit comments

Comments
 (0)