Skip to content

Commit adbda60

Browse files
committed
fixup! Populate driver exception error information
1 parent 80bca0d commit adbda60

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎packages/mysql-on-sqlite/src/sqlite/class-wp-mysql-on-sqlite-exception.php‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php
22

3+
/*
4+
* PDO uses camel case naming, enable non-snake case:
5+
* phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
6+
*/
7+
38
class WP_MySQL_On_SQLite_Exception extends PDOException {
49
/**
510
* The MySQL-on-SQLite driver that originated the exception.
@@ -27,7 +32,7 @@ public function __construct(
2732
parent::__construct( $message, 0, $previous );
2833
$this->code = $code;
2934
$this->driver = $driver;
30-
$this->errorInfo = $error_info ?? $this->create_error_info( $message, $code, $previous ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
35+
$this->errorInfo = $error_info ?? $this->create_error_info( $message, $code, $previous );
3136
}
3237

3338
public function get_driver(): WP_MySQL_On_SQLite {
@@ -44,8 +49,8 @@ public function get_driver(): WP_MySQL_On_SQLite {
4449
* @return array PDO-style error information.
4550
*/
4651
private function create_error_info( string $message, $code, ?Throwable $previous ): array {
47-
if ( $previous instanceof PDOException && is_array( $previous->errorInfo ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
48-
return $previous->errorInfo; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
52+
if ( $previous instanceof PDOException && is_array( $previous->errorInfo ) ) {
53+
return $previous->errorInfo;
4954
}
5055

5156
$sqlstate = is_string( $code ) && 5 === strlen( $code ) ? $code : 'HY000';

0 commit comments

Comments
 (0)