Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Collector return type more explicit #458

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Collector/Collector/AbstractCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function loadData(CollectedDataNode $collectedDataNode, string $cl

/**
* @phpstan-param array<T> $items
* @return ?A[]
* @return non-empty-array<A>|null
*/
protected function collectItems(array $items): ?array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract public function getNodeTypes(): array;

/**
* @param Node $node
* @phpstan-return null|array<T|CollectedError>
* @phpstan-return null|non-empty-array<T|CollectedError>
*/
abstract public function collectData(Node $node, Scope $scope): ?array;
}
4 changes: 2 additions & 2 deletions src/LatteContext/Collector/FormCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getNodeTypes(): array

/**
* @param ClassMethod $node
* @phpstan-return null|CollectedForm[]
* @phpstan-return null|non-empty-array<CollectedForm>
*/
public function collectData(Node $node, Scope $scope): ?array
{
Expand All @@ -51,7 +51,7 @@ public function collectData(Node $node, Scope $scope): ?array
}

/**
* @phpstan-return null|CollectedForm[]
* @phpstan-return null|non-empty-array<CollectedForm>
*/
private function findCreateComponent(ClassMethod $node, ClassReflection $classReflection, Scope $scope): ?array
{
Expand Down
2 changes: 1 addition & 1 deletion src/LatteContext/Collector/MethodReturnCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getNodeTypes(): array

/**
* @param Return_ $node
* @phpstan-return null|CollectedMethod[]
* @phpstan-return null|non-empty-array<CollectedMethod>
*/
public function collectData(Node $node, Scope $scope): ?array
{
Expand Down