Skip to content

Commit

Permalink
Merge pull request #1216 from kukulich/ast
Browse files Browse the repository at this point in the history
Removed `ReflectionProperty::getAst()` to prevent memory leaks
  • Loading branch information
Ocramius authored Sep 22, 2022
2 parents e1901bf + d44ff48 commit 054b4a3
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 127 deletions.
12 changes: 4 additions & 8 deletions src/Reflection/ReflectionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,14 +886,10 @@ static function (ReflectionClass $ancestor) use ($filter): array {
),
...array_map(
function (ReflectionClass $trait) use ($filter) {
return array_map(fn (ReflectionProperty $property): ReflectionProperty => ReflectionProperty::createFromNode(
$this->reflector,
$property->getAst(),
$property->getPositionInAst(),
$property->getDeclaringClass(),
$this,
$property->isPromoted(),
), $trait->getProperties($filter));
return array_map(
fn (ReflectionProperty $property): ReflectionProperty => ReflectionProperty::withImplementingClass($property, $this),
$trait->getProperties($filter),
);
},
$this->getTraits(),
),
Expand Down
Loading

0 comments on commit 054b4a3

Please sign in to comment.