Skip to content

Commit

Permalink
Improve API by removing nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Apr 5, 2021
1 parent 8a502f3 commit 499199f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/Doctrine/DBAL/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ public function execute($params = null)
/**
* Executes the statement with the currently bound parameters and return result.
*
* @param mixed[]|null $params
* @param mixed[] $params
*
* @throws Exception
*/
public function executeQuery(?array $params = null): BaseResult
public function executeQuery(array $params = []): BaseResult
{
if ($params === []) {
$params = null; // Workaround as long execute() exists and used internally.
}

$this->execute($params);

return new ForwardCompatibility\Result($this);
Expand All @@ -207,12 +211,16 @@ public function executeQuery(?array $params = null): BaseResult
/**
* Executes the statement with the currently bound parameters and return affected rows.
*
* @param mixed[]|null $params
* @param mixed[] $params
*
* @throws Exception
*/
public function executeStatement(?array $params = null): int
public function executeStatement(array $params = []): int
{
if ($params === []) {
$params = null; // Workaround as long execute() exists and used internally.
}

$this->execute($params);

return $this->rowCount();
Expand Down

0 comments on commit 499199f

Please sign in to comment.