@@ -515,28 +515,37 @@ protected function getDefaultPostProcessor()
515515 *
516516 * @param string $query
517517 * @param array $bindings
518- * @param Closure $callback
518+ * @param \ Closure $callback
519519 * @return mixed
520520 *
521- * @throws QueryException
521+ * @throws \Illuminate\Database\ QueryException
522522 */
523523 protected function runQueryCallback ($ query , $ bindings , Closure $ callback )
524524 {
525525 try {
526526 $ result = $ callback ($ query , $ bindings );
527527
528- if ($ result instanceof PDOStatement) {
528+ if ($ result instanceof \ PDOStatement) {
529529 $ errorInfo = $ result ->errorInfo ();
530530 if (isset ($ errorInfo [0 ]) && $ errorInfo [0 ] !== '00000 ' ) {
531- $ finalErrorMessage = sprintf ('SQLSTATE[%s] [%d] %s ' , $ errorInfo [0 ], (int ) $ errorInfo [1 ],
532- trim (preg_replace (['/^\[\d+]\s\(severity\s\d+\)\s/ ' , '/\s+/ ' ], ['' , ' ' ], $ errorInfo [2 ])));
533- throw new PDOException ($ finalErrorMessage , (int ) $ errorInfo [1 ]);
531+ $ finalErrorMessage = sprintf (
532+ 'SQLSTATE[%s] [%d] %s ' ,
533+ $ errorInfo [0 ],
534+ (int )$ errorInfo [1 ],
535+ trim (preg_replace (['/^\[\d+\]\s\(severity\s\d+\)\s/ ' , '/\s+/ ' ], ['' , ' ' ], $ errorInfo [2 ]))
536+ );
537+ throw new \PDOException ($ finalErrorMessage , (int )$ errorInfo [1 ]);
534538 }
535539 }
536540 return $ result ;
537541
538542 } catch (Throwable $ e ) {
539- throw new QueryException ($ this ->getName (), $ query , $ this ->prepareBindings ($ bindings ), $ e );
543+ throw new QueryException (
544+ $ this ->getName (),
545+ $ query ,
546+ $ this ->prepareBindings ($ bindings ),
547+ $ e
548+ );
540549 }
541550 }
542551}
0 commit comments