diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index b724902249..4d5ad1ec8a 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -403,7 +403,7 @@ class CLI while ($time > 0) { static::fwrite(STDOUT, $time . '... '); sleep(1); - $time --; + $time--; } static::write(); @@ -442,7 +442,7 @@ class CLI public static function newLine(int $num = 1) { // Do it once or more, write with empty string gives us a new line - for ($i = 0; $i < $num; $i ++) { + for ($i = 0; $i < $num; $i++) { static::write(); } } @@ -998,7 +998,7 @@ class CLI $maxColsLengths = []; // Read row by row and define the longest columns - for ($row = 0; $row < $totalRows; $row ++) { + for ($row = 0; $row < $totalRows; $row++) { $column = 0; // Current column index foreach ($tableRows[$row] as $col) { @@ -1013,13 +1013,13 @@ class CLI } // We can go check the size of the next column... - $column ++; + $column++; } } // Read row by row and add spaces at the end of the columns // to match the exact column length - for ($row = 0; $row < $totalRows; $row ++) { + for ($row = 0; $row < $totalRows; $row++) { $column = 0; foreach ($tableRows[$row] as $col) { @@ -1029,14 +1029,14 @@ class CLI $tableRows[$row][$column] = $tableRows[$row][$column] . str_repeat(' ', $diff); } - $column ++; + $column++; } } $table = ''; // Joins columns and append the well formatted rows to the table - for ($row = 0; $row < $totalRows; $row ++) { + for ($row = 0; $row < $totalRows; $row++) { // Set the table border-top if ($row === 0) { $cols = '+'; diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 2657586262..ce22b79b59 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -653,7 +653,7 @@ class BaseBuilder $joints = $joints[0]; array_unshift($joints, ['', 0]); - for ($i = count($joints) - 1, $pos = strlen($cond); $i >= 0; $i --) { + for ($i = count($joints) - 1, $pos = strlen($cond); $i >= 0; $i--) { $joints[$i][1] += strlen($joints[$i][0]); // offset $conditions[$i] = substr($cond, $joints[$i][1], $pos - $joints[$i][1]); $pos = $joints[$i][1] - strlen($joints[$i][0]); @@ -1419,7 +1419,7 @@ class BaseBuilder $this->QBWhereGroupStarted = true; $prefix = empty($this->$clause) ? '' : $type; $where = [ - 'condition' => $prefix . $not . str_repeat(' ', ++ $this->QBWhereGroupCount) . ' (', + 'condition' => $prefix . $not . str_repeat(' ', ++$this->QBWhereGroupCount) . ' (', 'escape' => false, ]; @@ -1999,7 +1999,7 @@ class BaseBuilder $sql = $this->_insertBatch($this->db->protectIdentifiers($table, true, $escape, false), $this->QBKeys, array_slice($this->QBSet, $i, $batchSize)); if ($this->testMode) { - ++$affectedRows; + $affectedRows++; } else { $this->db->query($sql, $this->binds, false); $affectedRows += $this->db->affectedRows(); diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 7186036f32..b1d92c154c 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -821,7 +821,7 @@ abstract class BaseConnection implements ConnectionInterface // When transactions are nested we only begin/commit/rollback the outermost ones if ($this->transDepth > 0) { - $this->transDepth ++; + $this->transDepth++; return true; } @@ -836,7 +836,7 @@ abstract class BaseConnection implements ConnectionInterface $this->transFailure = ($testMode === true); if ($this->_transBegin()) { - $this->transDepth ++; + $this->transDepth++; return true; } @@ -859,7 +859,7 @@ abstract class BaseConnection implements ConnectionInterface // When transactions are nested we only begin/commit/rollback the outermost ones if ($this->transDepth > 1 || $this->_transCommit()) { - $this->transDepth --; + $this->transDepth--; return true; } @@ -882,7 +882,7 @@ abstract class BaseConnection implements ConnectionInterface // When transactions are nested we only begin/commit/rollback the outermost ones if ($this->transDepth > 1 || $this->_transRollback()) { - $this->transDepth --; + $this->transDepth--; return true; } diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index ba190bda7b..9c22e34ca7 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -140,7 +140,7 @@ abstract class BaseResult implements ResultInterface } if ($_data !== null) { - for ($i = 0; $i < $c; $i ++) { + for ($i = 0; $i < $c; $i++) { $this->customResultObject[$className][$i] = new $className(); foreach ($this->{$_data}[$i] as $key => $value) { @@ -444,7 +444,7 @@ abstract class BaseResult implements ResultInterface return null; } - return isset($result[$this->currentRow + 1]) ? $result[++ $this->currentRow] : null; + return isset($result[$this->currentRow + 1]) ? $result[++$this->currentRow] : null; } //-------------------------------------------------------------------- @@ -464,7 +464,7 @@ abstract class BaseResult implements ResultInterface } if (isset($result[$this->currentRow - 1])) { - -- $this->currentRow; + $this->currentRow--; } return $result[$this->currentRow]; diff --git a/system/Database/BaseUtils.php b/system/Database/BaseUtils.php index 48d54f7f1a..2fcfd21429 100644 --- a/system/Database/BaseUtils.php +++ b/system/Database/BaseUtils.php @@ -57,7 +57,7 @@ abstract class BaseUtils */ public function __construct(ConnectionInterface &$db) { - $this->db = & $db; + $this->db = &$db; } //-------------------------------------------------------------------- @@ -91,7 +91,7 @@ abstract class BaseUtils return $this->db->dataCache['db_names']; } - for ($i = 0, $query = $query->getResultArray(), $c = count($query); $i < $c; $i ++) { + for ($i = 0, $query = $query->getResultArray(), $c = count($query); $i < $c; $i++) { $this->db->dataCache['db_names'][] = current($query[$i]); } diff --git a/system/Database/MySQLi/Forge.php b/system/Database/MySQLi/Forge.php index c3202a2e30..390ee2e1e5 100644 --- a/system/Database/MySQLi/Forge.php +++ b/system/Database/MySQLi/Forge.php @@ -207,9 +207,9 @@ class Forge extends BaseForge { $sql = ''; - for ($i = 0, $c = count($this->keys); $i < $c; $i ++) { + for ($i = 0, $c = count($this->keys); $i < $c; $i++) { if (is_array($this->keys[$i])) { - for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2 ++) { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) { if (! isset($this->fields[$this->keys[$i][$i2]])) { unset($this->keys[$i][$i2]); diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 334ac39df4..3012a76949 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -294,7 +294,7 @@ class Connection extends BaseConnection $retVal = []; - for ($i = 0, $c = count($query); $i < $c; $i ++) { + for ($i = 0, $c = count($query); $i < $c; $i++) { $retVal[$i] = new stdClass(); $retVal[$i]->name = $query[$i]->column_name; diff --git a/system/Database/Postgre/PreparedQuery.php b/system/Database/Postgre/PreparedQuery.php index dd9c3699c7..9c94b5c304 100644 --- a/system/Database/Postgre/PreparedQuery.php +++ b/system/Database/Postgre/PreparedQuery.php @@ -112,7 +112,7 @@ class PreparedQuery extends BasePreparedQuery $count = 0; return preg_replace_callback('/\?/', static function () use (&$count) { - $count ++; + $count++; return "\${$count}"; }, $sql); diff --git a/system/Database/Postgre/Result.php b/system/Database/Postgre/Result.php index bd1d2342d0..936adf3392 100644 --- a/system/Database/Postgre/Result.php +++ b/system/Database/Postgre/Result.php @@ -41,7 +41,7 @@ class Result extends BaseResult { $fieldNames = []; - for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i ++) { + for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i++) { $fieldNames[] = pg_field_name($this->resultID, $i); } @@ -59,7 +59,7 @@ class Result extends BaseResult { $retVal = []; - for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i ++) { + for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i++) { $retVal[$i] = new stdClass(); $retVal[$i]->name = pg_field_name($this->resultID, $i); $retVal[$i]->type = pg_field_type_oid($this->resultID, $i); diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index f461c03477..656854093b 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -141,12 +141,13 @@ class Builder extends BaseBuilder $joints = $joints[0]; array_unshift($joints, ['', 0]); - for ($i = count($joints) - 1, $pos = strlen($cond); $i >= 0; $i --) { + for ($i = count($joints) - 1, $pos = strlen($cond); $i >= 0; $i--) { $joints[$i][1] += strlen($joints[$i][0]); // offset $conditions[$i] = substr($cond, $joints[$i][1], $pos - $joints[$i][1]); $pos = $joints[$i][1] - strlen($joints[$i][0]); $joints[$i] = $joints[$i][0]; } + ksort($conditions); } else { $conditions = [$cond]; diff --git a/system/Database/SQLite3/Result.php b/system/Database/SQLite3/Result.php index 04109fb498..4bddc63fe8 100644 --- a/system/Database/SQLite3/Result.php +++ b/system/Database/SQLite3/Result.php @@ -43,7 +43,7 @@ class Result extends BaseResult { $fieldNames = []; - for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i ++) { + for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i++) { $fieldNames[] = $this->resultID->columnName($i); // @phpstan-ignore-line } @@ -70,7 +70,7 @@ class Result extends BaseResult $retVal = []; $this->resultID->fetchArray(SQLITE3_NUM); // @phpstan-ignore-line - for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i ++) { + for ($i = 0, $c = $this->getFieldCount(); $i < $c; $i++) { $retVal[$i] = new stdClass(); $retVal[$i]->name = $this->resultID->columnName($i); // @phpstan-ignore-line $type = $this->resultID->columnType($i); // @phpstan-ignore-line diff --git a/system/Debug/Iterator.php b/system/Debug/Iterator.php index 7f924b66a8..ca5233010d 100644 --- a/system/Debug/Iterator.php +++ b/system/Debug/Iterator.php @@ -75,9 +75,8 @@ class Iterator $start = microtime(true); $startMem = $maxMemory = memory_get_usage(true); - for ($i = 0; $i < $iterations; $i ++) { - $result = $test(); - + for ($i = 0; $i < $iterations; $i++) { + $result = $test(); $maxMemory = max($maxMemory, memory_get_usage(true)); unset($result); diff --git a/system/Email/Email.php b/system/Email/Email.php index 62742e7d8e..406a8c5ee7 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -691,7 +691,7 @@ class Email fclose($fp); } else { - $fileContent = & $file; // buffered file + $fileContent = &$file; // buffered file } // declare names on their own, to make phpcbf happy @@ -1042,7 +1042,7 @@ class Email $body = preg_match('/\