Skip to content

Commit b29b4f2

Browse files
committed
throw exception
1 parent 7113164 commit b29b4f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Storage/PDOConnector.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
namespace doganoo\PHPUtil\Storage;
2727

2828
use doganoo\PHPUtil\Exception\InvalidCredentialsException;
29+
use doganoo\PHPUtil\Exception\PHPUtilException;
2930
use PDO;
3031
use PDOStatement;
3132

@@ -154,12 +155,13 @@ private function hasMinimumCredentials(): bool {
154155
*
155156
* @param string $sql
156157
*
157-
* @return null|PDOStatement
158+
* @return PDOStatement
159+
* @throws PHPUtilException
158160
*/
159-
public function prepare(string $sql): ?PDOStatement {
161+
public function prepare(string $sql): PDOStatement {
160162
$statement = $this->getConnection()->prepare($sql);
161163
if ($statement === false) {
162-
return null;
164+
throw new PHPUtilException('cout not prepare');
163165
}
164166
$this->statement = $statement;
165167
return $statement;

0 commit comments

Comments
 (0)