| @@ -124,8 +124,10 @@ | ||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Create the schema table, if necessary. |
| 128 | + * | |
| 129 | + * @return void | |
| 128 | 130 | */ |
| 129 | 131 | public function create_schema_version_table() { |
| 130 | 132 | if ( ! $this->has_table( $this->get_schema_version_table_name() ) ) { |
| 131 | 133 | $t = $this->create_table( $this->get_schema_version_table_name() ); |
| @@ -136,8 +138,10 @@ | ||
| 136 | 138 | } |
| 137 | 139 | |
| 138 | 140 | /** |
| 139 | 141 | * Starts a transaction. |
| 142 | + * | |
| 143 | + * @return void | |
| 140 | 144 | */ |
| 141 | 145 | public function start_transaction() { |
| 142 | 146 | if ( $this->in_transaction() === false ) { |
| 143 | 147 | $this->begin_transaction(); |
| @@ -145,8 +149,10 @@ | ||
| 145 | 149 | } |
| 146 | 150 | |
| 147 | 151 | /** |
| 148 | 152 | * Commits a transaction. |
| 153 | + * | |
| 154 | + * @return void | |
| 149 | 155 | */ |
| 150 | 156 | public function commit_transaction() { |
| 151 | 157 | if ( $this->in_transaction() ) { |
| 152 | 158 | $this->commit(); |
| @@ -154,8 +160,10 @@ | ||
| 154 | 160 | } |
| 155 | 161 | |
| 156 | 162 | /** |
| 157 | 163 | * Rollbacks a transaction. |
| 164 | + * | |
| 165 | + * @return void | |
| 158 | 166 | */ |
| 159 | 167 | public function rollback_transaction() { |
| 160 | 168 | if ( $this->in_transaction() ) { |
| 161 | 169 | $this->rollback(); |
| @@ -292,9 +300,9 @@ | ||
| 292 | 300 | |
| 293 | 301 | $query_type = $this->determine_query_type( $query ); |
| 294 | 302 | $data = []; |
| 295 | 303 | if ( $query_type === Constants::SQL_SELECT || $query_type === Constants::SQL_SHOW ) { |
| 296 | - $data = $wpdb->get_results( $query, ARRAY_A ); | |
| 304 | + $data = $wpdb->get_results( $query, \ARRAY_A ); | |
| 297 | 305 | if ( $data === false ) { |
| 298 | 306 | return false; |
| 299 | 307 | } |
| 300 | 308 | |
| @@ -541,9 +549,9 @@ | ||
| 541 | 549 | $result = \array_change_key_case( $result, \CASE_LOWER ); |
| 542 | 550 | } |
| 543 | 551 | |
| 544 | 552 | return $result; |
| 545 | - } catch ( \Exception $e ) { | |
| 553 | + } catch ( Exception $e ) { | |
| 546 | 554 | return null; |
| 547 | 555 | } |
| 548 | 556 | } |
| 549 | 557 | |
| @@ -595,9 +603,9 @@ | ||
| 595 | 603 | 'CREATE %sINDEX %s ON %s(%s)', |
| 596 | 604 | ( $unique === true ) ? 'UNIQUE ' : '', |
| 597 | 605 | $this->identifier( $index_name ), |
| 598 | 606 | $this->identifier( $table_name ), |
| 599 | - \implode( ', ', $cols ) | |
| 607 | + \implode( ', ', $cols ), | |
| 600 | 608 | ); |
| 601 | 609 | |
| 602 | 610 | return $this->execute_ddl( $sql ); |
| 603 | 611 | } |
| @@ -649,9 +657,9 @@ | ||
| 649 | 657 | [ |
| 650 | 658 | 'null' => false, |
| 651 | 659 | 'default' => 'CURRENT_TIMESTAMP', |
| 652 | 660 | 'extra' => 'ON UPDATE CURRENT_TIMESTAMP', |
| 653 | - ] | |
| 661 | + ], | |
| 654 | 662 | ); |
| 655 | 663 | |
| 656 | 664 | return $created_at && $updated_at; |
| 657 | 665 | } |
| @@ -793,12 +801,10 @@ | ||
| 793 | 801 | else { |
| 794 | 802 | $column_type_sql .= \sprintf( '(%d)', $precision ); |
| 795 | 803 | } |
| 796 | 804 | } |
| 797 | - else { | |
| 798 | - if ( $scale ) { | |
| 799 | - throw new Exception( "Error adding $type column: precision cannot be empty if scale is specified" ); | |
| 800 | - } | |
| 805 | + elseif ( $scale ) { | |
| 806 | + throw new Exception( "Error adding $type column: precision cannot be empty if scale is specified" ); | |
| 801 | 807 | } |
| 802 | 808 | } |
| 803 | 809 | elseif ( $type === 'enum' ) { |
| 804 | 810 | if ( empty( $values ) ) { |
| @@ -806,9 +812,9 @@ | ||
| 806 | 812 | } |
| 807 | 813 | else { |
| 808 | 814 | $column_type_sql .= \sprintf( |
| 809 | 815 | "('%s')", |
| 810 | - \implode( "','", \array_map( [ $this, 'quote_string' ], $values ) ) | |
| 816 | + \implode( "','", \array_map( [ $this, 'quote_string' ], $values ) ), | |
| 811 | 817 | ); |
| 812 | 818 | } |
| 813 | 819 | } |
| 814 | 820 | // Not a decimal column. |