for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Yiisoft\Db\Mssql;
use PDOException;
use Throwable;
use Yiisoft\Db\Driver\PDO\AbstractCommandPDO;
use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface;
use Yiisoft\Db\Exception\ConvertException;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
/**
* Implements a database command that can be executed against a PDO (PHP Data Object) database connection for MSSQL
* Server.
*/
final class CommandPDO extends AbstractCommandPDO
{
* @psalm-suppress UnusedClosureParam
*
* @throws Exception
* @throws Throwable
protected function internalExecute(string|null $rawSql): void
$attempt = 0;
while (true) {
try {
if (
++$attempt === 1
&& $this->isolationLevel !== null
&& $this->db->getTransaction() === null
) {
$this->db->transaction(
fn (ConnectionPDOInterface $db) => $this->internalExecute($rawSql),
$db
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
fn (/** @scrutinizer ignore-unused */ ConnectionPDOInterface $db) => $this->internalExecute($rawSql),
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$this->isolationLevel
);
} else {
$this->pdoStatement?->execute();
}
break;
} catch (PDOException $e) {
$rawSql = $rawSql ?: $this->getRawSql();
$e = (new ConvertException($e, $rawSql))->run();
if ($this->retryHandler === null || !($this->retryHandler)($e, $attempt)) {
throw $e;
protected function getQueryBuilder(): QueryBuilderInterface
return $this->db->getQueryBuilder();
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.