From 44760a184e2645a9ed129c91b5b43a2556d82731 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 11 Sep 2026 17:05:29 +0700 Subject: [PATCH 1/2] chore: migrate from deptrac to structarmed --- .gitattributes | 2 +- .github/workflows/deptrac.yml | 23 --- .github/workflows/structarmed.yml | 78 +++++++++ README.md | 2 +- composer.json | 8 +- deptrac.yaml | 156 ------------------ structarmed.php | 42 +++++ tests/DatabaseHandlerTest.php | 16 +- tests/Payloads/ChainBuilderTest.php | 6 +- tests/PushAndPopWithDelayTest.php | 4 +- tests/_support/Config/Queue.php | 2 +- tests/_support/Config/Registrar.php | 4 +- .../Seeds/TestDatabaseQueueSeeder.php | 2 +- .../Database/Seeds/TestRedisQueueSeeder.php | 2 +- tests/_support/Jobs/Failure.php | 2 +- tests/_support/Jobs/Success.php | 2 +- 16 files changed, 147 insertions(+), 204 deletions(-) delete mode 100644 .github/workflows/deptrac.yml create mode 100644 .github/workflows/structarmed.yml delete mode 100644 deptrac.yaml create mode 100644 structarmed.php diff --git a/.gitattributes b/.gitattributes index 074fc2c..5cc464e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,7 +20,7 @@ CONTRIBUTING.md export-ignore tests/AutoReview/ export-ignore tests/system/ export-ignore utils/ export-ignore -deptrac.yaml export-ignore +structarmed.php export-ignore rector.php export-ignore phpunit.xml.dist export-ignore phpstan-baseline.neon.dist export-ignore diff --git a/.github/workflows/deptrac.yml b/.github/workflows/deptrac.yml deleted file mode 100644 index a41e15d..0000000 --- a/.github/workflows/deptrac.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Deptrac - -on: - pull_request: - branches: - - develop - paths: - - '**.php' - - 'composer.*' - - 'deptrac.yaml' - - '.github/workflows/deptrac.yml' - push: - branches: - - develop - paths: - - '**.php' - - 'composer.*' - - 'deptrac.yaml' - - '.github/workflows/deptrac.yml' - -jobs: - deptrac: - uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI47 diff --git a/.github/workflows/structarmed.yml b/.github/workflows/structarmed.yml new file mode 100644 index 0000000..c2acfb1 --- /dev/null +++ b/.github/workflows/structarmed.yml @@ -0,0 +1,78 @@ +name: StructArmed + +on: + pull_request: + branches: + - develop + paths: + - '**.php' + - 'composer.*' + - 'structarmed.php' + - '.github/workflows/structarmed.yml' + push: + branches: + - develop + paths: + - '**.php' + - 'composer.*' + - 'structarmed.php' + - '.github/workflows/structarmed.yml' + workflow_call: + inputs: + php-version: + required: false + type: string + default: '8.2' + +permissions: + contents: read + +jobs: + build: + name: Dependency Tracing + runs-on: ubuntu-latest + if: (! contains(github.event.head_commit.message, '[ci skip]')) + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Set up PHP + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2 + with: + php-version: ${{ inputs['php-version'] }} + tools: composer + extensions: intl, json, mbstring, xml + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV + + - name: Cache composer dependencies + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 + with: + path: ${{ env.COMPOSER_CACHE_FILES_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + if [ -f composer.lock ]; then + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader + else + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader + fi + + - name: Structarmed Cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: /tmp/structarmed + key: ${{ runner.os }}-structarmed-${{ github.run_id }} + restore-keys: ${{ runner.os }}-structarmed- + + - run: mkdir -p /tmp/structarmed + + - name: Run static analysis + run: vendor/bin/structarmed analyze diff --git a/README.md b/README.md index caf5e99..54689bf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Queues for the CodeIgniter 4 framework. [![PHPUnit](https://github.com/codeigniter4/queue/actions/workflows/phpunit.yml/badge.svg)](https://github.com/codeigniter4/queue/actions/workflows/phpunit.yml) [![PHPStan](https://github.com/codeigniter4/queue/actions/workflows/phpstan.yml/badge.svg)](https://github.com/codeigniter4/queue/actions/workflows/phpstan.yml) -[![Deptrac](https://github.com/codeigniter4/queue/actions/workflows/deptrac.yml/badge.svg)](https://github.com/codeigniter4/queue/actions/workflows/deptrac.yml) +[![StructArmed](https://github.com/codeigniter4/queue/actions/workflows/structarmed.yml/badge.svg)](https://github.com/codeigniter4/queue/actions/workflows/structarmed.yml) [![Coverage Status](https://coveralls.io/repos/github/codeigniter4/queue/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/queue?branch=develop) ![PHP](https://img.shields.io/badge/PHP-%5E8.2-blue) diff --git a/composer.json b/composer.json index d314be5..942276c 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "codeigniter4/framework": "^4.3", "predis/predis": "^2.0 || ^3.0", "phpstan/phpstan-strict-rules": "^2.0", - "php-amqplib/php-amqplib": "^3.7" + "php-amqplib/php-amqplib": "^3.7", + "boundwize/structarmed": "^0.17.3" }, "minimum-stability": "dev", "prefer-stable": true, @@ -34,7 +35,8 @@ }, "autoload-dev": { "psr-4": { - "Tests\\": "tests" + "Tests\\": "tests", + "Tests\\Support\\": "tests/_support" } }, "suggest": { @@ -66,7 +68,7 @@ "cs-fix": "php-cs-fixer fix --ansi --verbose --diff", "style": "@cs-fix", "deduplicate": "phpcpd src/ tests/", - "inspect": "deptrac analyze --cache-file=build/deptrac.cache", + "inspect": "vendor/bin/structarmed analyze", "mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit", "test": "phpunit" } diff --git a/deptrac.yaml b/deptrac.yaml deleted file mode 100644 index 3caa730..0000000 --- a/deptrac.yaml +++ /dev/null @@ -1,156 +0,0 @@ -deptrac: - paths: - - ./src/ - - ./vendor/codeigniter4/framework/system/ - exclude_files: - - '#.*test.*#i' - layers: - - name: Model - collectors: - - type: bool - must: - - type: class - value: .*[A-Za-z]+Model$ - must_not: - - type: directory - value: vendor/.* - - name: Vendor Model - collectors: - - type: bool - must: - - type: class - value: .*[A-Za-z]+Model$ - - type: directory - value: vendor/.* - - name: Controller - collectors: - - type: bool - must: - - type: class - value: .*\/Controllers\/.* - must_not: - - type: directory - value: vendor/.* - - name: Vendor Controller - collectors: - - type: bool - must: - - type: class - value: .*\/Controllers\/.* - - type: directory - value: vendor/.* - - name: Config - collectors: - - type: bool - must: - - type: directory - value: app/Config/.* - must_not: - - type: class - value: .*Services - - type: directory - value: vendor/.* - - name: Vendor Config - collectors: - - type: bool - must: - - type: directory - value: vendor/.*/Config/.* - must_not: - - type: class - value: .*Services - - name: Entity - collectors: - - type: bool - must: - - type: directory - value: app/Entities/.* - must_not: - - type: directory - value: vendor/.* - - name: Vendor Entity - collectors: - - type: bool - must: - - type: directory - value: vendor/.*/Entities/.* - - name: View - collectors: - - type: bool - must: - - type: directory - value: app/Views/.* - must_not: - - type: directory - value: vendor/.* - - name: Vendor View - collectors: - - type: bool - must: - - type: directory - value: vendor/.*/Views/.* - - name: Service - collectors: - - type: class - value: .*Services.* - ruleset: - Entity: - - Config - - Model - - Service - - Vendor Config - - Vendor Entity - - Vendor Model - Config: - - Service - - Vendor Config - Model: - - Config - - Entity - - Service - - Vendor Config - - Vendor Entity - - Vendor Model - Service: - - Config - - Vendor Config - - # Ignore anything in the Vendor layers - Vendor Model: - - Config - - Service - - Vendor Config - - Vendor Controller - - Vendor Entity - - Vendor Model - - Vendor View - Vendor Controller: - - Service - - Vendor Config - - Vendor Controller - - Vendor Entity - - Vendor Model - - Vendor View - Vendor Config: - - Config - - Service - - Vendor Config - - Vendor Controller - - Vendor Entity - - Vendor Model - - Vendor View - Vendor Entity: - - Service - - Vendor Config - - Vendor Controller - - Vendor Entity - - Vendor Model - - Vendor View - Vendor View: - - Service - - Vendor Config - - Vendor Controller - - Vendor Entity - - Vendor Model - - Vendor View - skip_violations: [] diff --git a/structarmed.php b/structarmed.php new file mode 100644 index 0000000..ce3a7cf --- /dev/null +++ b/structarmed.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +use Boundwize\StructArmed\Architecture; +use Boundwize\StructArmed\Preset\Preset; +use Boundwize\StructArmed\Preset\Presets\Psr4Preset; +use Boundwize\StructArmed\Rule\Rules\Class_\MustBeFinalRule; + +return Architecture::define() + ->rule( + 'tests.must_be_final', + new MustBeFinalRule(layer: 'tests'), + ) + ->skip([ + Psr4Preset::CLASSES_MUST_MATCH_COMPOSER => [ + __DIR__ . '/src/Database/Migrations', + ], + ]) + ->cacheDirectory(is_dir('/tmp') ? '/tmp/structarmed' : null) + ->withPresets(Preset::PSR4(), Preset::CODEQUALITY()) + ->layer('tests', __DIR__ . '/tests') + ->layerPattern('Model', '/^CodeIgniter\\\\Queue\\\\.*Model$/') + ->layerPattern('Controller', '/^CodeIgniter\\\\Queue\\\\Controllers\\\\.*$/') + ->layerPattern('Config', '/^CodeIgniter\\\\Queue\\\\Config\\\\.*$/', '/^.*Services$/') + ->layerPattern('Entity', '/^CodeIgniter\\\\Queue\\\\Entities\\\\.*$/') + ->layerPattern('Service', '/^.*Services$/') + ->ruleset([ + 'Entity' => ['Config', 'Model', 'Service'], + 'Config' => ['Service'], + 'Model' => ['Config', 'Entity', 'Service'], + 'Service' => ['Config'], + ]); diff --git a/tests/DatabaseHandlerTest.php b/tests/DatabaseHandlerTest.php index dadd42e..a23431c 100644 --- a/tests/DatabaseHandlerTest.php +++ b/tests/DatabaseHandlerTest.php @@ -89,7 +89,7 @@ public function testPush(): void $this->seeInDatabase('queue_jobs', [ 'queue' => 'queue', 'payload' => json_encode(['job' => 'success', 'data' => ['key' => 'value'], 'metadata' => []]), - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } @@ -108,7 +108,7 @@ public function testPushWithPriority(): void 'queue' => 'queue', 'payload' => json_encode(['job' => 'success', 'data' => ['key' => 'value'], 'metadata' => []]), 'priority' => 'high', - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } @@ -127,7 +127,7 @@ public function testPushAndPopWithPriority(): void 'queue' => 'queue', 'payload' => json_encode(['job' => 'success', 'data' => ['key1' => 'value1'], 'metadata' => []]), 'priority' => 'low', - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); $result = $handler->setPriority('high')->push('queue', 'success', ['key2' => 'value2']); @@ -137,7 +137,7 @@ public function testPushAndPopWithPriority(): void 'queue' => 'queue', 'payload' => json_encode(['job' => 'success', 'data' => ['key2' => 'value2'], 'metadata' => []]), 'priority' => 'high', - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); $result = $handler->pop('queue', ['high', 'low']); @@ -163,7 +163,7 @@ public function testPushWithDelay(): void $this->assertTrue($result->getStatus()); - $availableAt = 1703859376; + $availableAt = 1_703_859_376; $this->seeInDatabase('queue_jobs', [ 'queue' => 'queue-delay', @@ -202,7 +202,7 @@ public function testChain(): void ], ], ]), - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } @@ -244,7 +244,7 @@ public function testChainWithPriorityAndDelay(): void ], ], ]), - 'available_at' => 1703859316 + 60, // Adding delay to available_at + 'available_at' => 1_703_859_316 + 60, // Adding delay to available_at ]); } @@ -379,7 +379,7 @@ public function testFailedAndKeepJob(): void 'id' => 2, 'connection' => 'database', 'queue' => 'queue1', - 'failed_at' => 1703859316, + 'failed_at' => 1_703_859_316, ]); } diff --git a/tests/Payloads/ChainBuilderTest.php b/tests/Payloads/ChainBuilderTest.php index 6aa91ba..618b3be 100644 --- a/tests/Payloads/ChainBuilderTest.php +++ b/tests/Payloads/ChainBuilderTest.php @@ -73,7 +73,7 @@ public function testChainWithSingleJob(): void 'queue' => 'queue', ], ]), - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } @@ -116,7 +116,7 @@ public function testMultipleDifferentQueues(): void ], ], ]), - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } @@ -154,7 +154,7 @@ public function testChainWithManyJobs(): void ], ], ]), - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } } diff --git a/tests/PushAndPopWithDelayTest.php b/tests/PushAndPopWithDelayTest.php index 7ac34ae..b9e5658 100644 --- a/tests/PushAndPopWithDelayTest.php +++ b/tests/PushAndPopWithDelayTest.php @@ -57,13 +57,13 @@ public function testPushAndPopWithDelay(string $name, string $class): void $this->seeInDatabase('queue_jobs', [ 'queue' => 'queue-delay', 'payload' => json_encode(['job' => 'success', 'data' => ['key1' => 'value1'], 'metadata' => []]), - 'available_at' => 1703859376, + 'available_at' => 1_703_859_376, ]); $this->seeInDatabase('queue_jobs', [ 'queue' => 'queue-delay', 'payload' => json_encode(['job' => 'success', 'data' => ['key2' => 'value2'], 'metadata' => []]), - 'available_at' => 1703859316, + 'available_at' => 1_703_859_316, ]); } diff --git a/tests/_support/Config/Queue.php b/tests/_support/Config/Queue.php index c027552..a1f5472 100644 --- a/tests/_support/Config/Queue.php +++ b/tests/_support/Config/Queue.php @@ -21,7 +21,7 @@ use Tests\Support\Jobs\Failure; use Tests\Support\Jobs\Success; -class Queue extends BaseQueue +final class Queue extends BaseQueue { /** * Default handler. diff --git a/tests/_support/Config/Registrar.php b/tests/_support/Config/Registrar.php index 86a303e..dd8aead 100644 --- a/tests/_support/Config/Registrar.php +++ b/tests/_support/Config/Registrar.php @@ -18,14 +18,14 @@ * * Provides a basic registrar class for testing BaseConfig registration functions. */ -class Registrar +final class Registrar { /** * DB config array for testing purposes. * * @var array|bool|int|string>> */ - protected static array $dbConfig = [ + private static array $dbConfig = [ 'MySQLi' => [ 'DSN' => '', 'hostname' => '127.0.0.1', diff --git a/tests/_support/Database/Seeds/TestDatabaseQueueSeeder.php b/tests/_support/Database/Seeds/TestDatabaseQueueSeeder.php index 1b04659..74b2d51 100644 --- a/tests/_support/Database/Seeds/TestDatabaseQueueSeeder.php +++ b/tests/_support/Database/Seeds/TestDatabaseQueueSeeder.php @@ -20,7 +20,7 @@ use CodeIgniter\Queue\Models\QueueJobFailedModel; use CodeIgniter\Queue\Models\QueueJobModel; -class TestDatabaseQueueSeeder extends Seeder +final class TestDatabaseQueueSeeder extends Seeder { public function run(): void { diff --git a/tests/_support/Database/Seeds/TestRedisQueueSeeder.php b/tests/_support/Database/Seeds/TestRedisQueueSeeder.php index d14d86f..e59b039 100644 --- a/tests/_support/Database/Seeds/TestRedisQueueSeeder.php +++ b/tests/_support/Database/Seeds/TestRedisQueueSeeder.php @@ -24,7 +24,7 @@ use ReflectionException; use Tests\Support\Config\Queue as QueueConfig; -class TestRedisQueueSeeder extends Seeder +final class TestRedisQueueSeeder extends Seeder { /** * @throws RedisException|ReflectionException diff --git a/tests/_support/Jobs/Failure.php b/tests/_support/Jobs/Failure.php index fba6516..add1c50 100644 --- a/tests/_support/Jobs/Failure.php +++ b/tests/_support/Jobs/Failure.php @@ -16,7 +16,7 @@ use CodeIgniter\Queue\BaseJob; use Exception; -class Failure extends BaseJob +final class Failure extends BaseJob { /** * @throws Exception diff --git a/tests/_support/Jobs/Success.php b/tests/_support/Jobs/Success.php index 541beca..12616ec 100644 --- a/tests/_support/Jobs/Success.php +++ b/tests/_support/Jobs/Success.php @@ -15,7 +15,7 @@ use CodeIgniter\Queue\BaseJob; -class Success extends BaseJob +final class Success extends BaseJob { protected int $retryAfter = 6; protected int $tries = 3; From 30fb041ef561738dde7a43869a7b7504f2f453be Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 11 Sep 2026 17:13:59 +0700 Subject: [PATCH 2/2] fix rector deprecation notices --- rector.php | 32 +++++++++---------------------- src/Compatibility/SignalTrait.php | 4 +--- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/rector.php b/rector.php index 8d58a6f..2d23144 100644 --- a/rector.php +++ b/rector.php @@ -2,42 +2,41 @@ declare(strict_types=1); +/** + * This file is part of CodeIgniter Queue. + * + * (c) CodeIgniter Foundation + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector; use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector; -use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector; use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector; -use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector; use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector; use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector; -use Rector\CodeQuality\Rector\If_\CombineIfRector; -use Rector\CodeQuality\Rector\If_\ShortenElseIfRector; -use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector; use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector; use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector; use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector; use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; -use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector; -use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector; use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; -use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector; -use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; -use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\ValueObject\PhpVersion; @@ -47,7 +46,6 @@ SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_82, PHPUnitSetList::PHPUNIT_CODE_QUALITY, - PHPUnitSetList::PHPUNIT_100, ]); $rectorConfig->parallel(); @@ -88,14 +86,10 @@ // Note: requires php 8 RemoveUnusedPromotedPropertyRector::class, - AnnotationWithValueToAttributeRector::class, // May load view files directly when detecting classes StringClassNameToClassConstantRector::class, - // Supported from PHPUnit 10 - DataProviderAnnotationToAttributeRector::class, - AssertEmptyNullableObjectToAssertInstanceofRector::class, // Skip onInterruption method - called dynamically via reflection in SignalTrait @@ -109,27 +103,19 @@ $rectorConfig->rule(SimplifyUselessVariableRector::class); $rectorConfig->rule(RemoveAlwaysElseRector::class); - $rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class); - $rectorConfig->rule(ChangeNestedForeachIfsToEarlyContinueRector::class); $rectorConfig->rule(ChangeIfElseValueAssignToEarlyReturnRector::class); $rectorConfig->rule(SimplifyStrposLowerRector::class); - $rectorConfig->rule(CombineIfRector::class); $rectorConfig->rule(SimplifyIfReturnBoolRector::class); $rectorConfig->rule(InlineIfToExplicitIfRector::class); $rectorConfig->rule(PreparedValueToEarlyReturnRector::class); - $rectorConfig->rule(ShortenElseIfRector::class); - $rectorConfig->rule(SimplifyIfElseToTernaryRector::class); - $rectorConfig->rule(UnusedForeachValueToArrayKeysRector::class); $rectorConfig->rule(ChangeArrayPushToArrayAssignRector::class); $rectorConfig->rule(UnnecessaryTernaryExpressionRector::class); - $rectorConfig->rule(SimplifyRegexPatternRector::class); $rectorConfig->rule(FuncGetArgsToVariadicParamRector::class); $rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class); $rectorConfig->rule(SimplifyEmptyArrayCheckRector::class); $rectorConfig->rule(SimplifyEmptyCheckOnEmptyArrayRector::class); $rectorConfig->rule(TernaryEmptyArrayArrayDimFetchToCoalesceRector::class); $rectorConfig->rule(EmptyOnNullableObjectToInstanceOfRector::class); - $rectorConfig->rule(DisallowedEmptyRuleFixerRector::class); $rectorConfig ->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [ /** diff --git a/src/Compatibility/SignalTrait.php b/src/Compatibility/SignalTrait.php index 28c76e8..f3ad71b 100644 --- a/src/Compatibility/SignalTrait.php +++ b/src/Compatibility/SignalTrait.php @@ -90,9 +90,7 @@ protected function isPcntlAvailable(): bool */ protected function isPosixAvailable(): bool { - if (self::$isPosixAvailable === null) { - self::$isPosixAvailable = is_windows() ? false : extension_loaded('posix'); - } + self::$isPosixAvailable ??= is_windows() ? false : extension_loaded('posix'); return self::$isPosixAvailable; }