Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasPardon committed Mar 16, 2024
1 parent 0c4d28c commit 9d5501b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Services/CodeParser/CodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,14 @@ public function resolveClassesFromVariable(Variable $variable): array
}

if ($assignmentNode->expr instanceof Array_) {
array_push($classes, ...collect($assignmentNode->expr->items)->map(fn (ArrayItem $item) => $this->getFullyQualifiedClassName($item->value->class->toString()))->all());
array_push(
$classes,
...collect($assignmentNode->expr->items)
->map(function (ArrayItem $item) {
return $this->getFullyQualifiedClassName($item->value->class->toString());

Check failure on line 178 in src/Services/CodeParser/CodeParser.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property PhpParser\Node\Expr::$class.
})
->all()
);
}

// todo: handle other types of assignments
Expand Down Expand Up @@ -220,7 +227,11 @@ public function resolveClassesFromArgument(Arg $argument): array
}

if ($argument->value instanceof Array_) {
return collect($argument->value->items)->map(fn (ArrayItem $item) => $this->getFullyQualifiedClassName($item->value->class->toString()))->all();
return collect($argument->value->items)
->map(function (ArrayItem $item) {
return $this->getFullyQualifiedClassName($item->value->class->toString());

Check failure on line 232 in src/Services/CodeParser/CodeParser.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property PhpParser\Node\Expr::$class.
})
->all();
}

return [];
Expand Down

0 comments on commit 9d5501b

Please sign in to comment.