Skip to content

Commit

Permalink
Merge pull request #8102 from samsonasik/single-in-array
Browse files Browse the repository at this point in the history
[Rector] Apply SingleInArrayToCompareRector
  • Loading branch information
samsonasik authored Oct 27, 2023
2 parents 72dab03 + 1de08fa commit c6d9179
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector;
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodeQuality\Rector\If_\CombineIfRector;
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
Expand Down Expand Up @@ -142,4 +143,5 @@
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
$rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class);
$rectorConfig->rule(SingleInArrayToCompareRector::class);
};
2 changes: 1 addition & 1 deletion system/Config/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ protected static function discoverServices(string $name, array $arguments)
foreach ($files as $file) {
$classname = $locator->getClassname($file);

if (! in_array($classname, [Services::class], true)) {
if ($classname !== Services::class) {
static::$services[] = new $classname();
}
}
Expand Down
16 changes: 8 additions & 8 deletions tests/system/Database/Live/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testGroupBy(): void

public function testHavingBy(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand All @@ -63,7 +63,7 @@ public function testHavingBy(): void

public function testOrHavingBy(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('user')
Expand Down Expand Up @@ -134,7 +134,7 @@ public function testHavingNotIn(): void

public function testOrHavingNotIn(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand Down Expand Up @@ -207,7 +207,7 @@ public function testOrHavingLike(): void

public function testOrNotHavingLike(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand Down Expand Up @@ -237,7 +237,7 @@ public function testOrNotHavingLike(): void

public function testAndHavingGroupStart(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand Down Expand Up @@ -271,7 +271,7 @@ public function testAndHavingGroupStart(): void

public function testOrHavingGroupStart(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand Down Expand Up @@ -306,7 +306,7 @@ public function testOrHavingGroupStart(): void

public function testNotHavingGroupStart(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand Down Expand Up @@ -340,7 +340,7 @@ public function testNotHavingGroupStart(): void

public function testOrNotHavingGroupStart(): void
{
$isANSISQL = in_array($this->db->DBDriver, ['OCI8'], true);
$isANSISQL = $this->db->DBDriver === 'OCI8';

if ($isANSISQL) {
$result = $this->db->table('job')
Expand Down

0 comments on commit c6d9179

Please sign in to comment.