From 3a04d87ae26631c7ed25839f35cb041a0a8d0abb Mon Sep 17 00:00:00 2001 From: "A. B. M. Mahmudul Hasan" Date: Mon, 6 Apr 2026 20:42:42 +0600 Subject: [PATCH] chores --- .github/workflows/build.yml | 6 ++++-- captainhook.json | 4 ---- composer.json | 21 ++++++++------------- pest.xml | 34 +++++++++++++++++++++------------- phpstan.neon.dist | 12 +++++++++--- phpunit.xml | 34 ++++++++++++++++++++-------------- pint.json | 3 +-- psalm.xml | 1 - rector.php | 8 ++++---- 9 files changed, 67 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8454e20..0261ce7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Define shared matrix values id: matrix run: | - echo 'php_versions=["8.3","8.4","8.5"]' >> "$GITHUB_OUTPUT" + echo 'php_versions=["8.4","8.5"]' >> "$GITHUB_OUTPUT" echo 'dependency_versions=["prefer-lowest","prefer-stable"]' >> "$GITHUB_OUTPUT" run: @@ -57,7 +57,9 @@ jobs: composer test:code composer test:lint composer test:refactor - # Skip Psalm on prefer-lowest: older transitive amphp versions can trigger PHP 8.4+ deprecations at startup. + if [ "${{ matrix.dependency-version }}" != "prefer-lowest" ]; then + composer test:static + fi if [ "${{ matrix.dependency-version }}" != "prefer-lowest" ]; then composer test:security fi diff --git a/captainhook.json b/captainhook.json index 09484cf..8ef4f97 100644 --- a/captainhook.json +++ b/captainhook.json @@ -18,10 +18,6 @@ "action": "composer audit", "options": [] }, - { - "action": "composer test:security", - "options": [] - }, { "action": "composer tests", "options": [] diff --git a/composer.json b/composer.json index aee2eb5..56afbaf 100644 --- a/composer.json +++ b/composer.json @@ -40,21 +40,15 @@ } }, "scripts": { - "test:code": "@php vendor/bin/pest --parallel --processes=10", - "test:security": "@php vendor/bin/psalm --config=psalm.xml --security-analysis --show-info=false --no-progress --threads=1", - "test:refactor": "@php vendor/bin/rector process --dry-run", - "test:lint": "@php vendor/bin/pint --test", - "test:hook": [ - "captainhook hook:post-checkout", - "captainhook hook:pre-commit", - "captainhook hook:post-commit", - "captainhook hook:post-merge", - "captainhook hook:post-rewrite", - "captainhook hook:pre-push" - ], + "test:code": "@php -d error_reporting=24575 vendor/bin/pest --parallel --processes=10", + "test:security": "@php -d error_reporting=24575 vendor/bin/psalm --config=psalm.xml --security-analysis --show-info=false --no-progress --threads=1", + "test:static": "@php -d error_reporting=24575 vendor/bin/phpstan analyse --configuration=phpstan.neon.dist --memory-limit=1G --no-progress", + "test:refactor": "@php -d error_reporting=24575 vendor/bin/rector process --dry-run", + "test:lint": "@php -d error_reporting=24575 vendor/bin/pint --test", "tests": [ "@test:code", "@test:lint", + "@test:static", "@test:refactor", "@test:security" ], @@ -72,6 +66,7 @@ "pestphp/pest-plugin-drift": "^4.1", "rector/rector": "^2.3.9", "symfony/var-dumper": "^7.3 || ^8.0.8", - "vimeo/psalm": "^6.16.1" + "vimeo/psalm": "^6.16.1", + "tomasvotruba/cognitive-complexity": "^1.1" } } diff --git a/pest.xml b/pest.xml index 8f88bf3..d5d12d8 100644 --- a/pest.xml +++ b/pest.xml @@ -1,14 +1,22 @@ - - - - tests/Unit - - - tests/Feature - - - tests/Integration - - - \ No newline at end of file + + + + ./tests + + + + + ./src + + + + + + + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 2ca6adc..068e2a6 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,8 +1,14 @@ +includes: + - vendor/tomasvotruba/cognitive-complexity/config/extension.neon + parameters: - level: 3 + customRulesetUsed: true paths: - src - - tests - tmpDir: var/phpstan parallel: maximumNumberOfProcesses: 1 + cognitive_complexity: + class: 150 + function: 15 + dependency_tree: 150 + dependency_tree_types: [] diff --git a/phpunit.xml b/phpunit.xml index f504e3d..d5d12d8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,16 +1,22 @@ - - - - ./tests - - - - - ./src - - + + + + ./tests + + + + + ./src + + + + + + diff --git a/pint.json b/pint.json index 69de9d0..e6b7949 100644 --- a/pint.json +++ b/pint.json @@ -1,8 +1,7 @@ { "preset": "psr12", "exclude": [ - "tests", - "var" + "tests" ], "notPath": [ "rector.php" diff --git a/psalm.xml b/psalm.xml index 7dff260..37695ab 100644 --- a/psalm.xml +++ b/psalm.xml @@ -4,7 +4,6 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorLevel="3" - cacheDirectory=".psalm-cache" > diff --git a/rector.php b/rector.php index 83ea877..8a280ec 100644 --- a/rector.php +++ b/rector.php @@ -6,11 +6,11 @@ use Rector\Set\ValueObject\SetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->paths([__DIR__ . '/src']); + $rectorConfig->paths([__DIR__.'/src']); - $setConstant = SetList::class . '::PHP_' . PHP_MAJOR_VERSION . PHP_MINOR_VERSION; - if (!defined($setConstant)) { - $setConstant = SetList::class . '::PHP_84'; + $setConstant = SetList::class.'::PHP_'.PHP_MAJOR_VERSION.PHP_MINOR_VERSION; + if (! defined($setConstant)) { + $setConstant = SetList::class.'::PHP_84'; } $rectorConfig->sets([