Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Rector\Core\Configuration\Option;
use Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector;
use Rector\Performance\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\SOLID\Rector\If_\RemoveAlwaysElseRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
Expand Down Expand Up @@ -42,4 +43,5 @@
$services->set(SimplifyUselessVariableRector::class);
$services->set(RemoveAlwaysElseRector::class);
$services->set(PassStrictParameterToFunctionParameterRector::class);
$services->set(CountArrayToEmptyArrayComparisonRector::class);
};
2 changes: 1 addition & 1 deletion system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ public function setInsertBatch($key, string $value = '', bool $escape = null)
foreach ($key as $row)
{
$row = $this->objectToArray($row);
if (count(array_diff($keys, array_keys($row))) > 0 || count(array_diff(array_keys($row), $keys)) > 0)
if (array_diff($keys, array_keys($row)) !== [] || array_diff(array_keys($row), $keys) !== [])
{
// batch function above returns an error on an empty array
$this->QBSet[] = [];
Expand Down
8 changes: 4 additions & 4 deletions system/Database/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public function createTable(string $table, bool $ifNotExists = false, array $att

$table = $this->db->DBPrefix . $table;

if (count($this->fields) === 0)
if ($this->fields === [])
{
throw new RuntimeException('Field information is required.');
}
Expand Down Expand Up @@ -853,7 +853,7 @@ public function modifyColumn(string $table, $field): bool
$this->addField([$k => $field[$k]]);
}

if (count($this->fields) === 0)
if ($this->fields === [])
{
throw new RuntimeException('Field information is required');
}
Expand Down Expand Up @@ -1211,7 +1211,7 @@ protected function _processPrimaryKeys(string $table): string
}
}

if (count($this->primaryKeys) > 0)
if ($this->primaryKeys !== [])
{
$sql .= ",\n\tCONSTRAINT " . $this->db->escapeIdentifiers('pk_' . $table)
. ' PRIMARY KEY(' . implode(', ', $this->db->escapeIdentifiers($this->primaryKeys)) . ')';
Expand Down Expand Up @@ -1286,7 +1286,7 @@ protected function _processForeignKeys(string $table): string
'SET DEFAULT',
];

if (count($this->foreignKeys) > 0)
if ($this->foreignKeys !== [])
{
foreach ($this->foreignKeys as $field => $fkey)
{
Expand Down
2 changes: 1 addition & 1 deletion system/Database/SQLite3/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ protected function formatKeys($keys)
*/
protected function dropIndexes()
{
if (! is_array($this->keys) || ! count($this->keys))
if (! is_array($this->keys) || $this->keys === [])
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion system/Database/Sqlsrv/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ protected function _replace(string $table, array $keys, array $values): string
$q = $builder->get()->getResult();

// Delete entries if we find them
if (count($q))
if ($q !== [])
{
$delete = $this->db->table($table);
foreach ($bingo as $k => $v)
Expand Down
4 changes: 2 additions & 2 deletions system/Database/Sqlsrv/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ protected function _processForeignKeys(string $table): string
'SET DEFAULT',
];

if (count($this->foreignKeys) > 0)
if ($this->foreignKeys !== [])
{
foreach ($this->foreignKeys as $field => $fkey)
{
Expand Down Expand Up @@ -305,7 +305,7 @@ protected function _processPrimaryKeys(string $table): string
}
}

if (count($this->primaryKeys) > 0)
if ($this->primaryKeys !== [])
{
$sql = ",\n\tCONSTRAINT " . $this->db->escapeIdentifiers('pk_' . $table)
. ' PRIMARY KEY(' . implode(', ', $this->db->escapeIdentifiers($this->primaryKeys)) . ')';
Expand Down
2 changes: 1 addition & 1 deletion system/View/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function setFooting()
*/
public function makeColumns($array = [], $columnLimit = 0)
{
if (! is_array($array) || count($array) === 0 || ! is_int($columnLimit))
if (! is_array($array) || $array === [] || ! is_int($columnLimit))
{
return false;
}
Expand Down