Skip to content

Commit

Permalink
Use more precise list-types for getter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab authored and nikic committed Feb 18, 2025
1 parent fa02db3 commit 14f9c9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/PhpParser/Node/Stmt/ClassLike.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class ClassLike extends Node\Stmt {
public ?Node\Name $namespacedName;

/**
* @return TraitUse[]
* @return list<TraitUse>
*/
public function getTraitUses(): array {
$traitUses = [];
Expand All @@ -30,7 +30,7 @@ public function getTraitUses(): array {
}

/**
* @return ClassConst[]
* @return list<ClassConst>
*/
public function getConstants(): array {
$constants = [];
Expand All @@ -43,7 +43,7 @@ public function getConstants(): array {
}

/**
* @return Property[]
* @return list<Property>
*/
public function getProperties(): array {
$properties = [];
Expand Down Expand Up @@ -78,7 +78,7 @@ public function getProperty(string $name): ?Property {
/**
* Gets all methods defined directly in this class/interface/trait
*
* @return ClassMethod[]
* @return list<ClassMethod>
*/
public function getMethods(): array {
$methods = [];
Expand Down
4 changes: 2 additions & 2 deletions lib/PhpParser/NodeVisitor/FindingVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class FindingVisitor extends NodeVisitorAbstract {
/** @var callable Filter callback */
protected $filterCallback;
/** @var Node[] Found nodes */
/** @var list<Node> Found nodes */
protected array $foundNodes;

public function __construct(callable $filterCallback) {
Expand All @@ -24,7 +24,7 @@ public function __construct(callable $filterCallback) {
*
* Nodes are returned in pre-order.
*
* @return Node[] Found nodes
* @return list<Node> Found nodes
*/
public function getFoundNodes(): array {
return $this->foundNodes;
Expand Down

0 comments on commit 14f9c9d

Please sign in to comment.