@@ -85,7 +85,7 @@ public function delete(string $table, array $where): \PDOStatement
8585
8686 public function formatFields (array $ fields , string $ table = '' , string $ prefix = '' ): string
8787 {
88- if (! $ fields ) {
88+ if ($ fields === [] ) {
8989 throw new \InvalidArgumentException ('No fields provided for the query ' );
9090 }
9191
@@ -130,7 +130,7 @@ public function formatTable(string $table, string $alias = ''): string
130130 */
131131 private function formatConditions (array $ conditions , array & $ parameters ): string
132132 {
133- if (! $ conditions ) {
133+ if ($ conditions === [] ) {
134134 throw new \InvalidArgumentException ('No conditions provided for the query ' );
135135 }
136136
@@ -160,7 +160,7 @@ private function formatClause(string $field, $value, array & $parameters): strin
160160 return $ value !== null ;
161161 });
162162
163- if ($ value ) {
163+ if ($ value !== [] ) {
164164 $ placeholders = $ this ->formatParameters ($ value , $ parameters );
165165 return "( $ escaped IN $ placeholders OR $ escaped IS NULL) " ;
166166 }
@@ -250,7 +250,7 @@ private function formatLimit(?int $limit, array & $parameters): string
250250 */
251251 private function formatAssignments (array $ values , array & $ parameters ): string
252252 {
253- if (! $ values ) {
253+ if ($ values === [] ) {
254254 throw new \InvalidArgumentException ('No values provided for the query ' );
255255 }
256256
@@ -298,6 +298,10 @@ public function query(string $sql, array $parameters = []): \PDOStatement
298298 {
299299 $ query = $ this ->getConnection ()->prepare ($ sql );
300300
301+ if (! $ query instanceof \PDOStatement) {
302+ throw new \UnexpectedValueException ('Unexpected value returned by prepare query ' );
303+ }
304+
301305 foreach ($ parameters as $ name => $ value ) {
302306 $ this ->bindQueryParameter ($ query , \is_int ($ name ) ? $ name + 1 : $ name , $ value );
303307 }
0 commit comments