Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\AddParamArrayDocblockFromDataProviderRector\Fixture;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class CoverDummyIterable extends TestCase
{
/**
* @param iterable $names
*/
#[DataProvider('provideData')]
public function test(iterable $names): void
{
}

public static function provideData()
{
yield [['Tom', 'John']];
yield [[]];
yield [['John', 'Doe']];
}
}

?>
-----
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\AddParamArrayDocblockFromDataProviderRector\Fixture;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class CoverDummyIterable extends TestCase
{
/**
* @param string[] $names
*/
#[DataProvider('provideData')]
public function test(iterable $names): void
{
}

public static function provideData()
{
yield [['Tom', 'John']];
yield [[]];
yield [['John', 'Doe']];
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function isUsefulArrayTag(null|ReturnTagValueNode|ParamTagValueNode|VarTa
return ! $this->isMixedArray($type);
}

return ! in_array($type->name, ['array', 'mixed'], true);
return ! in_array($type->name, ['array', 'mixed', 'iterable'], true);
}

public function isMixedArray(TypeNode $typeNode): bool
Expand Down