diff --git a/.docker/php/Dockerfile b/.docker/php/Dockerfile index 270718e..431397e 100644 --- a/.docker/php/Dockerfile +++ b/.docker/php/Dockerfile @@ -41,6 +41,9 @@ RUN set -xe; \ chmod +x phive.phar && \ mv phive.phar /usr/local/bin/phive +COPY --from=boxproject/box:latest /box.phar /usr/bin/box +RUN chmod +x /usr/bin/box + WORKDIR /app COPY composer.* ./ diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a6af71e..228cbf6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -29,7 +29,7 @@ jobs: with: php-version: 8.2 ini-values: phar.readonly=0 - tools: composer + tools: composer, box coverage: none - name: Cache Composer packages @@ -45,26 +45,6 @@ jobs: with: composer-options: '--no-dev' - - name: Cache tools installed with PHIVE - uses: actions/cache@v4 - with: - path: "${{ runner.temp }}/.phive" - key: "os-${{ runner.os }}-php-${{ runner.php-version }}-phive-${{ hashFiles('**/.phive/phars.xml', '**/.phive/trust-gpg-keys.txt') }}" - restore-keys: "os-${{ runner.os }}-php-${{ runner.php-version }}-phive-" - - - name: Install PHIVE - uses: szepeviktor/phive@v1 - with: - home: "${{ runner.temp }}/.phive" - binPath: "${{ github.workspace }}/tools/phive" - - - name: Install PHP tools by PHIVE - uses: szepeviktor/phive-install@v1 - with: - home: "${{ runner.temp }}/.phive" - binPath: "${{ github.workspace }}/tools/phive" - trustGpgKeys: '$(cat ./.phive/trust-gpg-keys.txt)' - - name: Build PHAR run: composer build diff --git a/.phive/phars.xml b/.phive/phars.xml index 15d043e..f974a82 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,20 +1,8 @@ - - - + + - diff --git a/.phive/trust-gpg-keys.txt b/.phive/trust-gpg-keys.txt index 0e3368c..7976624 100644 --- a/.phive/trust-gpg-keys.txt +++ b/.phive/trust-gpg-keys.txt @@ -1 +1 @@ -033E5F8D801A2F8D,B1B5F6D21AB070E1,2DF45277AEF09A2F,4AA394086372C20A,E82B2FB314E9906E,9204DEE8CAE9C22C,51C67305FFC2E5C0 \ No newline at end of file +033E5F8D801A2F8D,B1B5F6D21AB070E1,4AA394086372C20A,E82B2FB314E9906E,9204DEE8CAE9C22C \ No newline at end of file diff --git a/composer.json b/composer.json index 6c99d37..e1446fa 100644 --- a/composer.json +++ b/composer.json @@ -52,12 +52,13 @@ "require-dev": { "dg/bypass-finals": "^1.7", "enlightn/security-checker": "^2.0", + "phpstan/phpstan": "^2.0", "roave/security-advisories": "dev-latest" }, "scripts": { "build": [ "php scripts/box/prepare-config.php", - "tools/box.phar compile --config=scripts/box/config.json" + "box compile --config=scripts/box/config.json" ], "check-all": [ "@cs-fixer-check", @@ -76,12 +77,12 @@ "@phpstan-clear", "@phpstan-analyse" ], - "phpstan-analyse": "tools/phpstan.phar analyse -c scripts/phpstan/config.neon ", + "phpstan-analyse": "vendor/bin/phpstan analyse -c scripts/phpstan/config.neon ", "phpstan-baseline": [ "@phpstan-clear", "@phpstan-analyse --generate-baseline scripts/phpstan/baseline.neon --allow-empty-baseline" ], - "phpstan-clear": "tools/phpstan.phar clear-result-cache -c scripts/phpstan/config.neon", + "phpstan-clear": "vendor/bin/phpstan clear-result-cache -c scripts/phpstan/config.neon", "phpunit": "tools/phpunit.phar -c scripts/phpunit/phpunit.xml", "require-check": "tools/composer-require-checker.phar check --config-file=scripts/composer-require-checker/config.json composer.json --output=text", "unused": "XDEBUG_MODE=off tools/composer-unused.phar unused -c ./scripts/composer-unused/config.php" diff --git a/composer.lock b/composer.lock index 652482d..a6e5f77 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "908ef55a0f06a0e53b5263f71ecdb783", + "content-hash": "a922d9370a4b1d7df8eaa4441e86e7cf", "packages": [ { "name": "clue/stream-filter", @@ -2050,6 +2050,64 @@ }, "time": "2023-12-10T07:17:09+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", + "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-11-11T15:43:04+00:00" + }, { "name": "psr/container", "version": "2.0.2", diff --git a/src/Service/Comment/Extractor.php b/src/Service/Comment/Extractor.php index ee6632e..e1d70aa 100644 --- a/src/Service/Comment/Extractor.php +++ b/src/Service/Comment/Extractor.php @@ -72,7 +72,7 @@ private function registerPart(string $line, CommentParts $parts): CommentPart */ private function splitLines(string $comment): array { - /** @var string[] $lines */ + /** @var list $lines */ $lines = preg_split("/([\r\n]+)/", $comment, -1, \PREG_SPLIT_DELIM_CAPTURE); $count = \count($lines); $currentLineIndex = 0;