rectorphp/rector-symfony

Overzealous StringToArrayArgumentProcessRector conversion

pbowyer opened this issue · 2 comments

The rule is rewriting a SQL query in my code:

    ---------- begin diff ----------
@@ @@
         // Comment removed
         // Comment removed
         $photo = null;
-        $stmt = $this->connection->getNativeConnection()->prepare("SELECT photo FROM card_exchange WHERE application_id = ?");
+        $stmt = $this->connection->getNativeConnection()->prepare(['SELECT', 'photo', 'FROM', 'card_exchange', 'WHERE', 'application_id', '=', '?']);
         $stmt->execute([$application->getId()]);
         $stmt->bindColumn(1, $photo, \PDO::PARAM_LOB);
         $stmt->fetch(\PDO::FETCH_BOUND);
    ----------- end diff -----------

Applied rules:
 * StringToArrayArgumentProcessRector (https://github.com/symfony/symfony/pull/27821/files)

Thank you for your report!

We'll need an isolated failing demo link from: http://getrector.com/demo,
that way we can reproduce the bug.

I've added your test fixture and it passes, so it was most likely fixed in newer Rector version than you use.

Upgrade to the latest Rector 0.18.5 and try 👍