Change executeQuery() with parameters to bindValue() with explicit values
use Doctrine\DBAL\Statement;
class SomeClass
{
public function run(Statement $statement, array $params): void
{
- $result = $statement->executeQuery($params)
+ foreach ($params as $key=> $value) {
+ $statement->bindValue($key + 1, $value);
+ }
+
+ $result = $statement->executeQuery();
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\Dbal40\Rector\StmtsAwareInterface\ExecuteQueryParamsToBindValueRector;
return RectorConfig::configure()
->withRules([
ExecuteQueryParamsToBindValueRector::class,
]);