Skip to content

Commit

Permalink
optional arg
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-w committed Feb 27, 2024
1 parent 6ac84d9 commit 72934b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public function select($query, $bindings = [], $useReadPdo = true, FetchMode $fe

$statement->execute();

return $statement->fetchAll(...($fetchMode ?? new FetchMode)->arguments());
return $statement->fetchAll($fetchMode);
});
}

Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ public function statement(): PDOStatement
/**
* @return mixed
*/
public function fetch(FetchMode $mode): mixed
public function fetch(FetchMode $mode = null): mixed
{
return $this->statement->fetch(...$mode->arguments());
return $this->statement->fetch(...($mode ? $mode->arguments() : []));
}

/**
* @return mixed
* @return array|false
*/
public function fetchAll(FetchMode $mode): mixed
public function fetchAll(FetchMode $mode = null): array|false
{
return $this->statement->fetchAll(...$mode->arguments());
return $this->statement->fetchAll(...($mode ? $mode->arguments() : []));
}

/**
Expand Down

0 comments on commit 72934b0

Please sign in to comment.