Skip to content

Commit f7c94ed

Browse files
committed
DecoratorExtension: fixed usage with empty config options
1 parent 640f1a2 commit f7c94ed

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/DI/Extensions/DecoratorExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ class DecoratorExtension extends Nette\DI\CompilerExtension
2828
public function beforeCompile()
2929
{
3030
foreach ($this->getConfig() as $class => $info) {
31+
$info = (array) $info;
3132
$this->validate($info, $this->defaults, $this->prefix($class));
3233
$info += $this->defaults;
3334
if ($info['inject'] !== NULL) {
3435
$info['tags'][InjectExtension::TAG_INJECT] = $info['inject'];
3536
}
36-
$this->addSetups($class, $info['setup']);
37-
$this->addTags($class, $info['tags']);
37+
$this->addSetups($class, (array) $info['setup']);
38+
$this->addTags($class, (array) $info['tags']);
3839
}
3940
}
4041

tests/DI/Compiler.extension.decorator.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ decorator:
4242
- setup
4343
tags: [b, tag: 1]
4444
45+
spec1:
46+
setup:
47+
tags:
48+
49+
spec2:
50+
4551
services:
4652
one:
4753
class: Service

0 commit comments

Comments
 (0)