We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8c6498f commit 8b31febCopy full SHA for 8b31feb
1 file changed
src/Resolver/TemplateChain/DataObject/TemplateChain.php
@@ -76,8 +76,20 @@ public function getParent(TemplateTypeInterface $templateType): TemplateTypeInte
76
77
public function getLastChild(): TemplateTypeInterface
78
{
79
- reset($this->chain);
80
- return current($this->chain);
+ $extendedNamespaces = [];
+ $lastChild = null;
81
+
82
+ foreach ($this->chain as $templateType) {
83
+ $parentNamespace = $templateType->getParentNamespace();
84
+ if ($parentNamespace) {
85
+ $extendedNamespaces[$parentNamespace] = true;
86
+ }
87
+ if (!isset($extendedNamespaces[$templateType->getNamespace()])) {
88
+ $lastChild = $templateType;
89
90
91
92
+ return $lastChild ?? reset($this->chain);
93
}
94
95
public function hasParent(TemplateTypeInterface $templateType): bool
0 commit comments