Skip to content

Commit

Permalink
Remove redundant checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Nov 23, 2023
1 parent 56363cb commit 5136e62
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Driver/Pdo/AbstractPdoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,18 @@ protected function logQuery(string $rawSql, string $category): void

protected function queryInternal(int $queryMode): mixed
{
$rawSql = '';

if ($this->logger !== null || $this->profiler !== null) {
$rawSql = $this->getRawSql();
}

$logCategory = self::class . '::' . $this->getQueryMode($queryMode);

$this->logQuery($rawSql, $logCategory);
$this->logger?->log(LogLevel::INFO, $rawSql = $this->getRawSql(), [$logCategory]);

$queryContext = new CommandContext(__METHOD__, $logCategory, $this->getSql(), $this->getParams());

$this->profiler?->begin($rawSql, $queryContext);
/**
* @psalm-var string $rawSql
* @psalm-suppress RedundantConditionGivenDocblockType
* @psalm-suppress DocblockTypeContradiction
*/
$this->profiler?->begin($rawSql ??= $this->getRawSql(), $queryContext);
try {
/** @psalm-var mixed $result */
$result = parent::queryInternal($queryMode);
Expand Down

0 comments on commit 5136e62

Please sign in to comment.