Skip to content

Commit 62cfa2b

Browse files
committed
refactor: Move component context parentContexts outside of deps
1 parent ccf00cb commit 62cfa2b

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

Component/AbstractComponentContext.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class AbstractComponentContext implements ComponentContextInterface
1111
{
1212
public function __construct(
13+
protected array $parentContexts = [],
1314
protected array $dependencies = []
1415
) {
1516
}
@@ -23,17 +24,10 @@ public function __call(string $methodName, array $arguments)
2324
}
2425
}
2526

26-
if (isset($this->dependencies['parentContext'])) {
27-
$parentContext = $this->dependencies['parentContext'];
28-
return $parentContext->{$methodName}(...$arguments);
29-
}
30-
31-
if (isset($this->dependencies['parentContexts'])) {
32-
foreach ($this->dependencies['parentContexts'] as $parentContext) {
33-
try {
34-
return $parentContext->{$methodName}(...$arguments);
35-
} catch (Throwable $e) {
36-
}
27+
foreach ($this->parentContexts as $parentContext) {
28+
try {
29+
return $parentContext->{$methodName}(...$arguments);
30+
} catch (Throwable $e) {
3731
}
3832
}
3933

0 commit comments

Comments
 (0)