Skip to content

Commit

Permalink
skip iterable already there
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 27, 2023
1 parent 09a962c commit 7356bae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 38 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Rector\Tests\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector\Fixture;

final class SkipReturnTypeIterable
{
public function run(): iterable
{
yield from $this->getData();
}

private function getData(): array
{
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function refactorWithScope(Node $node, Scope $scope): ?Node
// skip already filled type
if ($node->returnType instanceof Node && $this->isNames(
$node->returnType,
['Iterator', 'Generator', 'Traversable']
['Iterator', 'Generator', 'Traversable', 'iterable']
)) {
return null;
}
Expand Down

0 comments on commit 7356bae

Please sign in to comment.