Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rector] Apply SingleInArrayToCompareRector #8102

Merged
merged 1 commit into from
Oct 27, 2023
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 @@ -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
Loading