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

Change to wrong return type #2381

Closed
snapshotpl opened this issue Dec 3, 2019 · 1 comment
Closed

Change to wrong return type #2381

snapshotpl opened this issue Dec 3, 2019 · 1 comment
Labels

Comments

@snapshotpl
Copy link
Contributor

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.

@TomasVotruba
Copy link
Member

Thanks for reporting 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants