Skip to content

Commit d605ac4

Browse files
committed
CS fixes
1 parent c3ec28c commit d605ac4

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

wp-includes/sqlite/class-wp-sqlite-translator.php

+12-13
Original file line numberDiff line numberDiff line change
@@ -1128,23 +1128,23 @@ private function make_sqlite_field_definition( $field ) {
11281128
* This mode allows the use of `NULL` when NOT NULL is set on a column that falls back to DEFAULT.
11291129
* SQLite does not support this behavior, so we need to add the `ON CONFLICT REPLACE` clause to the column definition.
11301130
*/
1131-
if ($field->not_null) {
1131+
if ( $field->not_null ) {
11321132
$definition .= ' ON CONFLICT REPLACE';
11331133
}
11341134
/**
11351135
* The value of DEFAULT can be NULL. PHP would print this as an empty string, so we need a special case for it.
11361136
*/
1137-
if (null === $field->default) {
1137+
if ( null === $field->default ) {
11381138
$definition .= ' DEFAULT NULL';
1139-
} else if (false !== $field->default) {
1139+
} elseif ( false !== $field->default ) {
11401140
$definition .= ' DEFAULT ' . $field->default;
1141-
} else if ($field->not_null) {
1141+
} elseif ( $field->not_null ) {
11421142
/**
11431143
* If the column is NOT NULL, we need to provide a default value to match WPDB behavior caused by removing the STRICT_TRANS_TABLES mode.
11441144
*/
1145-
if ('text' === $field->sqlite_data_type) {
1145+
if ( 'text' === $field->sqlite_data_type ) {
11461146
$definition .= ' DEFAULT \'\'';
1147-
} else if (in_array($field->sqlite_data_type, array('integer', 'real'), true)) {
1147+
} elseif ( in_array( $field->sqlite_data_type, array( 'integer', 'real' ), true ) ) {
11481148
$definition .= ' DEFAULT 0';
11491149
}
11501150
}
@@ -3377,19 +3377,19 @@ private function execute_show() {
33773377
case 'TABLE STATUS': // FROM `database`.
33783378
// Match the optional [{FROM | IN} db_name]
33793379
$database_expression = $this->rewriter->consume();
3380-
if ( $database_expression->token === 'FROM' || $database_expression->token === 'IN' ) {
3380+
if ( 'FROM' === $database_expression->token || 'IN' === $database_expression->token ) {
33813381
$this->rewriter->consume();
33823382
$database_expression = $this->rewriter->consume();
33833383
}
33843384

33853385
$pattern = '%';
33863386
// [LIKE 'pattern' | WHERE expr]
3387-
if($database_expression->token === 'LIKE') {
3387+
if ( 'LIKE' === $database_expression->token ) {
33883388
$pattern = $this->rewriter->consume()->value;
3389-
} else if($database_expression->token === 'WHERE') {
3389+
} elseif ( 'WHERE' === $database_expression->token ) {
33903390
// @TODO Support me please.
3391-
} else if($database_expression->token !== ';') {
3392-
throw new Exception( 'Syntax error: Unexpected token ' . $database_expression->token .' in query '. $this->mysql_query );
3391+
} elseif ( ';' !== $database_expression->token ) {
3392+
throw new Exception( 'Syntax error: Unexpected token ' . $database_expression->token . ' in query ' . $this->mysql_query );
33933393
}
33943394

33953395
$database_expression = $this->rewriter->skip();
@@ -3418,12 +3418,11 @@ private function execute_show() {
34183418
type='table'
34193419
AND name LIKE :pattern
34203420
ORDER BY name",
3421-
34223421
array(
34233422
':pattern' => $pattern,
34243423
)
34253424
);
3426-
$tables = $this->strip_sqlite_system_tables( $stmt->fetchAll( $this->pdo_fetch_mode ) );
3425+
$tables = $this->strip_sqlite_system_tables( $stmt->fetchAll( $this->pdo_fetch_mode ) );
34273426
foreach ( $tables as $table ) {
34283427
$table_name = $table->Name; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
34293428
$stmt = $this->execute_sqlite_query( "SELECT COUNT(1) as `Rows` FROM $table_name" );

0 commit comments

Comments
 (0)