From 63f68a8655bf6e8ddc4ec9943fb4712a388386fe Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Sun, 23 Nov 2025 19:03:12 +0100 Subject: [PATCH 1/2] fix: extend Services class with CodeIgniter's BaseService (#198) * fix: extend Services class with CodeIgniter's BaseService * chore: remove BooleanInIfConditionRuleFixerRector rector rule + run cs-fix --- rector.php | 2 -- src/Config/Services.php | 4 ++-- src/RunResolver.php | 2 +- src/Task.php | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/rector.php b/rector.php index e824476..9736338 100644 --- a/rector.php +++ b/rector.php @@ -48,7 +48,6 @@ use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; -use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\ValueObject\PhpVersion; @@ -161,7 +160,6 @@ $rectorConfig->rule(StringClassNameToClassConstantRector::class); $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); $rectorConfig->rule(CompleteDynamicPropertiesRector::class); - $rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class); $rectorConfig->rule(SingleInArrayToCompareRector::class); $rectorConfig->rule(VersionCompareFuncCallToConstantRector::class); $rectorConfig->rule(ExplicitBoolCompareRector::class); diff --git a/src/Config/Services.php b/src/Config/Services.php index bc8fb68..60531a4 100644 --- a/src/Config/Services.php +++ b/src/Config/Services.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Tasks\Config; +use CodeIgniter\Config\BaseService; use CodeIgniter\Tasks\CronExpression; use CodeIgniter\Tasks\Scheduler; -use Config\Services as BaseServices; -class Services extends BaseServices +class Services extends BaseService { /** * Returns the Task Scheduler diff --git a/src/RunResolver.php b/src/RunResolver.php index e9d24f5..1eb22ac 100644 --- a/src/RunResolver.php +++ b/src/RunResolver.php @@ -151,7 +151,7 @@ protected function isInList($value, string $list): bool { $list = explode(',', $list); - return in_array(trim($value), $list, true); + return in_array(trim((string) $value), $list, true); } /** diff --git a/src/Task.php b/src/Task.php index b1b2cb6..9cd2bc1 100644 --- a/src/Task.php +++ b/src/Task.php @@ -365,7 +365,7 @@ protected function buildName() */ public function __get(string $key) { - if ($key === 'name' && empty($this->name)) { + if ($key === 'name' && (! isset($this->name) || ($this->name === ''))) { return $this->buildName(); } From f7574908c58fc999d4a00825748a329f81596a04 Mon Sep 17 00:00:00 2001 From: michalsn Date: Sun, 23 Nov 2025 19:09:20 +0100 Subject: [PATCH 2/2] fix: rector --- rector.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rector.php b/rector.php index 9736338..54de98e 100644 --- a/rector.php +++ b/rector.php @@ -43,6 +43,7 @@ use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; +use Rector\PHPUnit\CodeQuality\Rector\StmtsAwareInterface\DeclareStrictTypesTestsRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Set\ValueObject\LevelSetList; @@ -119,6 +120,9 @@ __DIR__ . '/tests/_support/Commands/TasksExample.php', __DIR__ . '/tests/unit/TaskRunnerTest.php', ], + + // Temporary fix + DeclareStrictTypesTestsRector::class, ]); // auto import fully qualified class names