| Subject |
Details |
| Rector version |
v0.6.0 |
| PHP version |
PHP 7.3.12 |
Current Behaviour
Rector change collectionCallback return type to iterable.
Minimal PHP Code Causing Issue
<?php
class Query {
private function collectionCallback(): callable
{
return function (int $offset, int $itemCountPerPage): iterable {
$stmt = $this->connection->executeQuery('SELECT * FROM *');
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
yield EventsEntity::forCollection();
}
};
}
}
---------- begin diff ----------
--- Original
+++ New
@@ -24,7 +24,7 @@
return new Callback($this->collectionCallback(), $this->countCallback());
}
- private function collectionCallback(): callable
+ private function collectionCallback(): iterable
{
return function (int $offset, int $itemCountPerPage): iterable {
$sql = 'SELECT id '
----------- end diff -----------
Applied rules:
* Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector
* Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector
Expected Behaviour
Nothing changed.
Current Behaviour
Rector change
collectionCallbackreturn type toiterable.Minimal PHP Code Causing Issue
Expected Behaviour
Nothing changed.