Merge pull request #4837 from paulbalandan/unary-op

Define rules on unary operators
This commit is contained in:
John Paul E. Balandan, CPA 2021-06-17 00:25:35 +08:00 committed by GitHub
commit 361590b0df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 73 additions and 68 deletions

View File

@ -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();

View File

@ -464,7 +464,7 @@ abstract class BaseResult implements ResultInterface
}
if (isset($result[$this->currentRow - 1])) {
-- $this->currentRow;
$this->currentRow--;
}
return $result[$this->currentRow];

View File

@ -147,6 +147,7 @@ class Builder extends BaseBuilder
$pos = $joints[$i][1] - strlen($joints[$i][0]);
$joints[$i] = $joints[$i][0];
}
ksort($conditions);
} else {
$conditions = [$cond];

View File

@ -77,7 +77,6 @@ class Iterator
for ($i = 0; $i < $iterations; $i++) {
$result = $test();
$maxMemory = max($maxMemory, memory_get_usage(true));
unset($result);

View File

@ -579,7 +579,7 @@ class URI
{
// The segment should treat the array as 1-based for the user
// but we still have to deal with a zero-based array.
$number -= 1;
$number--;
if ($number > count($this->segments) && ! $this->silent) {
throw HTTPException::forURISegmentOutOfRange($number);
@ -601,7 +601,7 @@ class URI
{
// The segment should treat the array as 1-based for the user
// but we still have to deal with a zero-based array.
$number -= 1;
$number--;
if ($number > count($this->segments) + 1) {
if ($this->silent) {

View File

@ -95,6 +95,7 @@ final class CodeIgniter4 extends AbstractRuleset
'function_to_constant' => true,
'heredoc_indentation' => ['indentation' => 'start_plus_one'],
'heredoc_to_nowdoc' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'lambda_not_used_import' => true,
'line_ending' => true,
@ -110,6 +111,8 @@ final class CodeIgniter4 extends AbstractRuleset
'no_trailing_comma_in_singleline_array' => true,
'no_unset_cast' => true,
'no_whitespace_before_comma_in_array' => ['after_heredoc' => true],
'not_operator_with_space' => false,
'not_operator_with_successor_space' => true,
'normalize_index_brace' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_align' => true,
@ -183,6 +186,7 @@ final class CodeIgniter4 extends AbstractRuleset
],
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'standardize_increment' => true,
'static_lambda' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
@ -194,6 +198,7 @@ final class CodeIgniter4 extends AbstractRuleset
],
'trim_array_spaces' => true,
'whitespace_after_comma_in_array' => true,
'unary_operator_spaces' => true,
'visibility_required' => ['elements' => ['const', 'method', 'property']],
'yoda_style' => [
'equal' => false,