Skip to content

Commit

Permalink
Core: MagicMethodsByClass: Add support for entity inherit.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored Apr 26, 2022
1 parent 53fb347 commit 219fd61
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Core/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,15 @@ private function getMagicMethodsByClass(object $entity, ?string $prefix = null):
}
if (isset($cache[$class]) === false) {
$classRef = $this->getReflection($entity);
if (preg_match_all('~@method\s+(?:\S+\s+)?(\w+)\(~', (string) $classRef->getDocComment(), $parser) > 0) {
$cache[$class] = $parser[1] ?? [];
} else {
$cache[$class] = [];
}
do {
if (preg_match_all('~@method\s+(?:\S+\s+)?(\w+)\(~', (string) $classRef->getDocComment(), $parser) > 0) {
$cache[$class] = array_merge($cache[$class] ?? [], $parser[1] ?? []);
} else {
$cache[$class] = [];
}
$classRef = $classRef->getParentClass();
} while ($classRef !== false);
$cache[$class] = array_unique($cache[$class]);
}

$return = [];
Expand Down

0 comments on commit 219fd61

Please sign in to comment.