Skip to content

Commit

Permalink
ensure stringification of an array will result as an InvalidServiceCo…
Browse files Browse the repository at this point in the history
…nfigException

Signed-off-by: waahhhh <40632052+waahhhh@users.noreply.github.com>
  • Loading branch information
waahhhh committed Aug 20, 2020
1 parent 28f0a4b commit 7570967
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/GeneratedInjectorDelegator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __invoke(ContainerInterface $container, $name, callable $callbac
{
$config = $container->has('config') ? $container->get('config') : [];
$aotConfig = $config['dependencies']['auto']['aot'] ?? [];
$namespace = empty($aotConfig['namespace']) ? 'Laminas\Di\Generated' : $aotConfig['namespace'];
$namespace = $aotConfig['namespace'] ?? 'Laminas\Di\Generated';

if (! is_string($namespace)) {
throw new InvalidServiceConfigException('Provided namespace is not a string.');
Expand Down
2 changes: 1 addition & 1 deletion test/GeneratedInjectorDelegatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testProvidedNamespaceIsNotAString()
->willReturn(true)
->shouldBeCalledTimes(1);
$container->get('config')
->willReturn(['dependencies' => ['auto' => ['aot' => ['namespace' => 123]]]])
->willReturn(['dependencies' => ['auto' => ['aot' => ['namespace' => []]]]])
->shouldBeCalledTimes(1);

$delegator = new GeneratedInjectorDelegator();
Expand Down

0 comments on commit 7570967

Please sign in to comment.