Skip to content

Commit

Permalink
Merge pull request #111 from hctorres02/main
Browse files Browse the repository at this point in the history
Check existence of childTypes method
  • Loading branch information
driftingly authored Jul 28, 2023
2 parents 0651c4b + 56fd959 commit 531253b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/HasChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ public function classToAlias(string $className): string
*/
public function getChildTypes(): array
{
return property_exists($this, 'childTypes') ? $this->childTypes : [];
if (method_exists($this, 'childTypes')) {
return $this->childTypes();
}

if (property_exists($this, 'childTypes')) {
return $this->childTypes;
}

return [];
}
}

0 comments on commit 531253b

Please sign in to comment.