GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( deb718...3121b4 )
by Steeven
03:03
created
src/Sql/Drivers/Sqlite/Connection.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function getDatabases()
125 125
     {
126
-        $this->queriesResultCache[ 'databaseNames' ][] = pathinfo($this->database, PATHINFO_FILENAME);
126
+        $this->queriesResultCache['databaseNames'][] = pathinfo($this->database, PATHINFO_FILENAME);
127 127
 
128
-        return $this->queriesResultCache[ 'databaseNames' ];
128
+        return $this->queriesResultCache['databaseNames'];
129 129
     }
130 130
 
131 131
     // ------------------------------------------------------------------------
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function getTables($prefixLimit = false)
145 145
     {
146
-        if (empty($this->queriesResultCache[ 'tableNames' ])) {
146
+        if (empty($this->queriesResultCache['tableNames'])) {
147 147
 
148 148
             $sqlStatement = 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\'';
149 149
 
150
-            if ($prefixLimit !== false && $this->config[ 'tablePrefix' ] !== '') {
151
-                $sqlStatement .= ' AND "NAME" LIKE \'' . $this->escapeLikeString($this->config[ 'tablePrefix' ]) . "%' ";
150
+            if ($prefixLimit !== false && $this->config['tablePrefix'] !== '') {
151
+                $sqlStatement .= ' AND "NAME" LIKE \'' . $this->escapeLikeString($this->config['tablePrefix']) . "%' ";
152 152
             }
153 153
 
154 154
             $result = $this->query($sqlStatement);
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
                 foreach ($result as $row) {
158 158
                     // Do we know from which column to get the table name?
159 159
                     if ( ! isset($key)) {
160
-                        if (isset($row[ 'table_name' ])) {
160
+                        if (isset($row['table_name'])) {
161 161
                             $key = 'table_name';
162
-                        } elseif (isset($row[ 'TABLE_NAME' ])) {
162
+                        } elseif (isset($row['TABLE_NAME'])) {
163 163
                             $key = 'TABLE_NAME';
164 164
                         } else {
165 165
                             /* We have no other choice but to just get the first element's key.
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
                         }
173 173
                     }
174 174
 
175
-                    $this->queriesResultCache[ 'tableNames' ][] = $row->offsetGet($key);
175
+                    $this->queriesResultCache['tableNames'][] = $row->offsetGet($key);
176 176
                 }
177 177
             }
178 178
         }
179 179
 
180
-        return $this->queriesResultCache[ 'tableNames' ];
180
+        return $this->queriesResultCache['tableNames'];
181 181
     }
182 182
 
183 183
     // ------------------------------------------------------------------------
@@ -195,24 +195,24 @@  discard block
 block discarded – undo
195 195
     {
196 196
         $table = $this->prefixTable($table);
197 197
 
198
-        if (empty($this->queriesResultCache[ 'tableColumns' ][ $table ])) {
198
+        if (empty($this->queriesResultCache['tableColumns'][$table])) {
199 199
             $result = $this->query('PRAGMA TABLE_INFO(' . $this->protectIdentifiers($table, true, null, false) . ')');
200 200
 
201 201
             if ($result->count()) {
202 202
                 foreach ($result as $row) {
203 203
                     // Do we know from where to get the column's name?
204 204
                     if ( ! isset($key)) {
205
-                        if (isset($row[ 'name' ])) {
205
+                        if (isset($row['name'])) {
206 206
                             $key = 'name';
207 207
                         }
208 208
                     }
209 209
 
210
-                    $this->queriesResultCache[ 'tableColumns' ][ $table ][ $row->offsetGet($key) ] = $row;
210
+                    $this->queriesResultCache['tableColumns'][$table][$row->offsetGet($key)] = $row;
211 211
                 }
212 212
             }
213 213
         }
214 214
 
215
-        return $this->queriesResultCache[ 'tableColumns' ][ $table ];
215
+        return $this->queriesResultCache['tableColumns'][$table];
216 216
     }
217 217
 
218 218
     // ------------------------------------------------------------------------
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         if (false !== ($result = $this->handle->query($statement->getSqlFinalStatement()))) {
332 332
             $i = 0;
333 333
             while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
334
-                $rows[ $i ] = $row;
334
+                $rows[$i] = $row;
335 335
                 $i++;
336 336
             }
337 337
         } else {
Please login to merge, or discard this patch.
src/Sql/Drivers/MySql/Forge.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -86,84 +86,84 @@  discard block
 block discarded – undo
86 86
         // Columns Statement
87 87
         $columnStatements = [];
88 88
         foreach ($columns as $columnName => $columnAttributes) {
89
-            if (isset($columnAttributes[ 'type' ])) {
90
-                if (isset($columnAttributes[ 'foreign_key' ])) {
91
-                    $foreignKeys[ $columnName ] = $columnAttributes[ 'foreign_key' ];
89
+            if (isset($columnAttributes['type'])) {
90
+                if (isset($columnAttributes['foreign_key'])) {
91
+                    $foreignKeys[$columnName] = $columnAttributes['foreign_key'];
92 92
                 }
93 93
 
94 94
                 $columnStatementLine = [];
95 95
                 $columnName = $this->conn->escapeIdentifiers($columnName);
96
-                $columnAttributes[ 'type' ] = strtoupper($columnAttributes[ 'type' ]);
96
+                $columnAttributes['type'] = strtoupper($columnAttributes['type']);
97 97
 
98
-                if (isset($columnAttributes[ 'primary_key' ])) {
99
-                    if ($columnAttributes[ 'primary_key' ] === true) {
98
+                if (isset($columnAttributes['primary_key'])) {
99
+                    if ($columnAttributes['primary_key'] === true) {
100 100
                         $primaryKeys[] = $columnName;
101 101
                     }
102 102
                 }
103 103
 
104
-                if (isset($columnAttributes[ 'unique' ])) {
105
-                    if ($columnAttributes[ 'unique' ] === true) {
104
+                if (isset($columnAttributes['unique'])) {
105
+                    if ($columnAttributes['unique'] === true) {
106 106
                         $uniqueKeys[] = $columnName;
107 107
                     }
108 108
                 }
109 109
 
110
-                if ($columnAttributes[ 'type' ] === 'ENUM') {
111
-                    if (empty($columnAttributes[ 'value' ])) {
110
+                if ($columnAttributes['type'] === 'ENUM') {
111
+                    if (empty($columnAttributes['value'])) {
112 112
                         continue;
113 113
                     } else {
114
-                        if (is_string($columnAttributes[ 'value' ])) {
115
-                            $columnAttributes[ 'value' ] = explode(',', $columnAttributes[ 'value' ]);
114
+                        if (is_string($columnAttributes['value'])) {
115
+                            $columnAttributes['value'] = explode(',', $columnAttributes['value']);
116 116
                         }
117 117
 
118
-                        $columnAttributes[ 'value' ] = array_map(function ($value) {
118
+                        $columnAttributes['value'] = array_map(function($value) {
119 119
                             return $this->conn->escape(str_replace('\'', '', trim($value)));
120
-                        }, $columnAttributes[ 'value' ]);
120
+                        }, $columnAttributes['value']);
121 121
 
122 122
                         $columnStatementLine[] = $columnName .
123
-                            ' ' . $columnAttributes[ 'type' ] . '(' .
124
-                            implode(',', $columnAttributes[ 'value' ])
123
+                            ' ' . $columnAttributes['type'] . '(' .
124
+                            implode(',', $columnAttributes['value'])
125 125
                             . ')';
126 126
                     }
127
-                } elseif (isset($columnAttributes[ 'length' ])) {
128
-                    $columnStatementLine[] = $columnName . ' ' . $columnAttributes[ 'type' ] . '(' . $columnAttributes[ 'length' ] . ')';
127
+                } elseif (isset($columnAttributes['length'])) {
128
+                    $columnStatementLine[] = $columnName . ' ' . $columnAttributes['type'] . '(' . $columnAttributes['length'] . ')';
129 129
                 } else {
130
-                    $columnStatementLine[] = $columnName . ' ' . $columnAttributes[ 'type' ];
130
+                    $columnStatementLine[] = $columnName . ' ' . $columnAttributes['type'];
131 131
                 }
132 132
 
133
-                if (isset($columnAttributes[ 'unsigned' ])) {
134
-                    if ($columnAttributes[ 'unsigned' ] === true) {
135
-                        if (in_array($columnAttributes[ 'type' ],
133
+                if (isset($columnAttributes['unsigned'])) {
134
+                    if ($columnAttributes['unsigned'] === true) {
135
+                        if (in_array($columnAttributes['type'],
136 136
                             ['INT', 'BIGINT', 'SMALLINT', 'TINYINT', 'FLOAT', 'DECIMAL', 'REAL'])) {
137 137
                             $columnStatementLine[] = 'UNSIGNED';
138 138
                         }
139 139
                     }
140 140
                 }
141 141
 
142
-                if (isset($columnAttributes[ 'collate' ])) {
143
-                    $columnStatementLine[] = 'COLLATE ' . $columnAttributes[ 'collate' ];
144
-                } elseif (in_array($columnAttributes[ 'type' ],
142
+                if (isset($columnAttributes['collate'])) {
143
+                    $columnStatementLine[] = 'COLLATE ' . $columnAttributes['collate'];
144
+                } elseif (in_array($columnAttributes['type'],
145 145
                     ['CHAR', 'VARCHAR', 'TEXT', 'LONGTEXT', 'TINYTEXT', 'ENUM'])) {
146 146
                     $columnStatementLine[] = 'COLLATE ' . $this->conn->getConfig('collate');
147 147
                 }
148 148
 
149
-                if (isset($columnAttributes[ 'not_null' ])) {
150
-                    if ($columnAttributes[ 'not_null' ] === true) {
149
+                if (isset($columnAttributes['not_null'])) {
150
+                    if ($columnAttributes['not_null'] === true) {
151 151
                         $columnStatementLine[] = 'NOT NULL';
152 152
                     }
153 153
                 }
154 154
 
155
-                if (isset($columnAttributes[ 'default' ])) {
156
-                    $columnStatementLine[] = 'DEFAULT ' . $this->conn->escape($columnAttributes[ 'default' ]);
155
+                if (isset($columnAttributes['default'])) {
156
+                    $columnStatementLine[] = 'DEFAULT ' . $this->conn->escape($columnAttributes['default']);
157 157
                 }
158 158
 
159
-                if (isset($columnAttributes[ 'auto_increment' ])) {
160
-                    if ($columnAttributes[ 'auto_increment' ] === true) {
159
+                if (isset($columnAttributes['auto_increment'])) {
160
+                    if ($columnAttributes['auto_increment'] === true) {
161 161
                         $columnStatementLine[] = 'AUTO_INCREMENT ';
162 162
                     }
163 163
                 }
164 164
 
165
-                if (isset($columnAttributes[ 'comment' ])) {
166
-                    $columnStatementLine[] = 'COMMENT ' . $columnAttributes[ 'comment' ];
165
+                if (isset($columnAttributes['comment'])) {
166
+                    $columnStatementLine[] = 'COMMENT ' . $columnAttributes['comment'];
167 167
                 }
168 168
 
169 169
                 $columnStatements[] = "\t" . implode(' ', $columnStatementLine);
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
         // Foreign Keys Statement
194 194
         if (count($foreignKeys)) {
195 195
             foreach ($foreignKeys as $foreignKeyColumnName => $foreignKeyAttributes) {
196
-                if (empty($foreignKeyAttributes[ 'name' ])) {
197
-                    $foreignKeyAttributes[ 'name' ] = 'fk_' . $foreignKeyColumnName;
196
+                if (empty($foreignKeyAttributes['name'])) {
197
+                    $foreignKeyAttributes['name'] = 'fk_' . $foreignKeyColumnName;
198 198
                 }
199 199
 
200
-                if (isset($foreignKeyAttributes[ 'references' ])) {
200
+                if (isset($foreignKeyAttributes['references'])) {
201 201
                     $keyStatements[] = 'KEY ' .
202
-                        $this->conn->escapeIdentifiers($foreignKeyAttributes[ 'name' ]) .
202
+                        $this->conn->escapeIdentifiers($foreignKeyAttributes['name']) .
203 203
                         ' (' . $this->conn->escapeIdentifiers($foreignKeyColumnName) . ')';
204 204
 
205
-                    $referenceParts = array_map('trim', explode('.', $foreignKeyAttributes[ 'references' ]));
205
+                    $referenceParts = array_map('trim', explode('.', $foreignKeyAttributes['references']));
206 206
                     list($referenceTable, $referenceColumn) = $referenceParts;
207 207
 
208 208
                     $referenceOnDelete = 'NO ACTION';
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
                         'SET NULL',
216 216
                     ];
217 217
 
218
-                    if (isset($foreignKeyAttributes[ 'on_delete' ])) {
219
-                        if (in_array($foreignKeyAttributes[ 'on_delete' ], $validReferenceActions)) {
220
-                            $referenceOnDelete = $foreignKeyAttributes[ 'on_delete' ];
218
+                    if (isset($foreignKeyAttributes['on_delete'])) {
219
+                        if (in_array($foreignKeyAttributes['on_delete'], $validReferenceActions)) {
220
+                            $referenceOnDelete = $foreignKeyAttributes['on_delete'];
221 221
                         }
222 222
                     }
223 223
 
224
-                    if (isset($foreignKeyAttributes[ 'on_update' ])) {
225
-                        if (in_array($foreignKeyAttributes[ 'on_update' ], $validReferenceActions)) {
226
-                            $referenceOnUpdate = $foreignKeyAttributes[ 'on_update' ];
224
+                    if (isset($foreignKeyAttributes['on_update'])) {
225
+                        if (in_array($foreignKeyAttributes['on_update'], $validReferenceActions)) {
226
+                            $referenceOnUpdate = $foreignKeyAttributes['on_update'];
227 227
                         }
228 228
                     }
229 229
 
230 230
                     $constraintStatements[] = 'CONSTRAINT ' .
231
-                        $this->conn->escapeIdentifiers($foreignKeyAttributes[ 'name' ]) .
231
+                        $this->conn->escapeIdentifiers($foreignKeyAttributes['name']) .
232 232
                         ' FOREIGN KEY (' . $this->conn->escapeIdentifiers($foreignKeyColumnName) . ') REFERENCES ' .
233 233
                         $this->conn->escapeIdentifiers($referenceTable) . ' (' . $this->conn->escapeIdentifiers($referenceColumn) .
234 234
                         ') ON DELETE ' . $referenceOnDelete . ' ON UPDATE ' . $referenceOnUpdate;
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
             array_merge($columnStatements, $keyStatements, $constraintStatements));
241 241
 
242 242
         if (empty($attributes)) {
243
-            $attributes[ 'engine' ] = 'InnoDB';
244
-            $attributes[ 'default' ] = 'DEFAULT';
245
-            $attributes[ 'charset' ] = $this->conn->getConfig('charset');
246
-            $attributes[ 'collate' ] = $this->conn->getConfig('collate');
243
+            $attributes['engine'] = 'InnoDB';
244
+            $attributes['default'] = 'DEFAULT';
245
+            $attributes['charset'] = $this->conn->getConfig('charset');
246
+            $attributes['collate'] = $this->conn->getConfig('collate');
247 247
         }
248 248
 
249 249
         $attributeStatements = [];
@@ -309,63 +309,63 @@  discard block
 block discarded – undo
309 309
         $alterTableStatementStrings[] = strtoupper($action);
310 310
         $alterTableStatementStrings[] = $this->conn->escapeIdentifiers($column);
311 311
 
312
-        if (isset($attributes[ 'type' ])) {
313
-            if ($attributes[ 'type' ] === 'ENUM') {
314
-                if (empty($attributes[ 'value' ])) {
312
+        if (isset($attributes['type'])) {
313
+            if ($attributes['type'] === 'ENUM') {
314
+                if (empty($attributes['value'])) {
315 315
                     return false;
316 316
                 } else {
317
-                    if (is_string($attributes[ 'value' ])) {
318
-                        $attributes[ 'value' ] = explode(',', $attributes[ 'value' ]);
317
+                    if (is_string($attributes['value'])) {
318
+                        $attributes['value'] = explode(',', $attributes['value']);
319 319
                     }
320 320
 
321
-                    $attributes[ 'value' ] = array_map(function ($value) {
321
+                    $attributes['value'] = array_map(function($value) {
322 322
                         return $this->conn->escape(str_replace('\'', '', trim($value)));
323
-                    }, $attributes[ 'value' ]);
323
+                    }, $attributes['value']);
324 324
 
325
-                    $alterTableStatementStrings[] = $attributes[ 'type' ] . '(' .
326
-                        implode(',', $attributes[ 'value' ])
325
+                    $alterTableStatementStrings[] = $attributes['type'] . '(' .
326
+                        implode(',', $attributes['value'])
327 327
                         . ')';
328 328
                 }
329
-            } elseif (isset($attributes[ 'length' ])) {
330
-                $alterTableStatementStrings[] = $attributes[ 'type' ] . '(' . $attributes[ 'length' ] . ')';
329
+            } elseif (isset($attributes['length'])) {
330
+                $alterTableStatementStrings[] = $attributes['type'] . '(' . $attributes['length'] . ')';
331 331
             } else {
332
-                $alterTableStatementStrings[] = $attributes[ 'type' ];
332
+                $alterTableStatementStrings[] = $attributes['type'];
333 333
             }
334 334
 
335
-            if (isset($attributes[ 'unsigned' ])) {
336
-                if ($attributes[ 'unsigned' ] === true) {
337
-                    if (in_array($attributes[ 'type' ],
335
+            if (isset($attributes['unsigned'])) {
336
+                if ($attributes['unsigned'] === true) {
337
+                    if (in_array($attributes['type'],
338 338
                         ['INT', 'BIGINT', 'SMALLINT', 'TINYINT', 'FLOAT', 'DECIMAL', 'REAL'])) {
339 339
                         $alterTableStatementStrings[] = 'UNSIGNED';
340 340
                     }
341 341
                 }
342 342
             }
343 343
 
344
-            if (isset($attributes[ 'collate' ])) {
345
-                $alterTableStatementStrings[] = 'COLLATE ' . $attributes[ 'collate' ];
346
-            } elseif (in_array($attributes[ 'type' ],
344
+            if (isset($attributes['collate'])) {
345
+                $alterTableStatementStrings[] = 'COLLATE ' . $attributes['collate'];
346
+            } elseif (in_array($attributes['type'],
347 347
                 ['CHAR', 'VARCHAR', 'TEXT', 'LONGTEXT', 'TINYTEXT', 'ENUM'])) {
348 348
                 $alterTableStatementStrings[] = 'COLLATE ' . $this->conn->getConfig('collate');
349 349
             }
350 350
 
351
-            if (isset($attributes[ 'not_null' ])) {
352
-                if ($attributes[ 'not_null' ] === true) {
351
+            if (isset($attributes['not_null'])) {
352
+                if ($attributes['not_null'] === true) {
353 353
                     $alterTableStatementStrings[] = 'NOT NULL';
354 354
                 }
355 355
             }
356 356
 
357
-            if (isset($attributes[ 'default' ])) {
358
-                $alterTableStatementStrings[] = 'DEFAULT ' . $this->conn->escape($attributes[ 'default' ]);
357
+            if (isset($attributes['default'])) {
358
+                $alterTableStatementStrings[] = 'DEFAULT ' . $this->conn->escape($attributes['default']);
359 359
             }
360 360
 
361
-            if (isset($attributes[ 'auto_increment' ])) {
362
-                if ($attributes[ 'auto_increment' ] === true) {
361
+            if (isset($attributes['auto_increment'])) {
362
+                if ($attributes['auto_increment'] === true) {
363 363
                     $alterTableStatementStrings[] = 'AUTO_INCREMENT ';
364 364
                 }
365 365
             }
366 366
 
367
-            if (isset($attributes[ 'comment' ])) {
368
-                $alterTableStatementStrings[] = 'COMMENT ' . $attributes[ 'comment' ];
367
+            if (isset($attributes['comment'])) {
368
+                $alterTableStatementStrings[] = 'COMMENT ' . $attributes['comment'];
369 369
             }
370 370
 
371 371
             $statementLines[] = implode(' ', $alterTableStatementStrings) . ';';
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     {
407 407
         $statementLines[] = 'ALTER TABLE ' . $this->conn->escapeIdentifiers($table);
408 408
 
409
-        $keys = array_map(function ($column) {
409
+        $keys = array_map(function($column) {
410 410
             return $this->conn->escapeIdentifiers($column);
411 411
         }, $columns);
412 412
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
     {
480 480
         $statementLines[] = 'ALTER TABLE ' . $this->conn->escapeIdentifiers($table);
481 481
 
482
-        $keys = array_map(function ($column) {
482
+        $keys = array_map(function($column) {
483 483
             return $this->conn->escapeIdentifiers($column);
484 484
         }, $columns);
485 485
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      */
508 508
     protected function platformCreateTableIndexesStatement($table, array $columns, $unique = false)
509 509
     {
510
-        $keys = array_map(function ($column) {
510
+        $keys = array_map(function($column) {
511 511
             return $this->conn->escapeIdentifiers($column);
512 512
         }, $columns);
513 513
 
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
         $columns = array_keys($conditions);
591 591
 
592 592
         if (count($conditions) == 1) {
593
-            $statementLines[] = 'ADD CHECK (' . $this->conn->escapeIdentifiers($columns[ 0 ]) . ')';
593
+            $statementLines[] = 'ADD CHECK (' . $this->conn->escapeIdentifiers($columns[0]) . ')';
594 594
         } else {
595 595
             $conditionStatementStrings = [];
596 596
 
597 597
             foreach ($conditions as $column => $condition) {
598 598
                 if (preg_match('/\s*(?:<|>|!)?=\s*|\s*<>?\s*|\s*>\s*/i', $column, $match, PREG_OFFSET_CAPTURE)) {
599
-                    $operator = trim($match[ 0 ]);
599
+                    $operator = trim($match[0]);
600 600
                     $column = trim(str_replace($operator, '', $column));
601 601
 
602 602
                     $conditionStatementStrings[] = $this->conn->escapeIdentifiers($column) . $operator . $this->conn->escape($condition);
Please login to merge, or discard this patch.