diff --git a/.github/workflows/grumphp.yml b/.github/workflows/grumphp.yml index e3c1e69d..f9573183 100644 --- a/.github/workflows/grumphp.yml +++ b/.github/workflows/grumphp.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest, macos-latest] #windows-latest currently not working - php-versions: ['8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3'] composer-options: ['', '--prefer-lowest'] composer-versions: ['composer:v2'] fail-fast: false @@ -39,10 +39,10 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - if: matrix.php-versions != '8.2' + if: matrix.php-versions != '8.3' run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} - name: Install dependencies (Ignore platform) - if: matrix.php-versions == '8.2' + if: matrix.php-versions == '8.3' run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} --ignore-platform-req=php+ - name: Set git variables run: | diff --git a/appveyor.yml b/appveyor.yml index 4a4ec2ee..5863645b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,10 +7,12 @@ platform: #matrix: # allow_failures: -# - php_version: 8.2 +# - php_version: 8.3 environment: matrix: + - dependencies: highest + php_version: 8.3 - dependencies: highest php_version: 8.2 - dependencies: highest @@ -65,8 +67,8 @@ install: # Install dependencies - ps: cd $Env:project_directory - - IF %dependencies%==lowest composer update --prefer-dist --prefer-lowest --prefer-stable --no-progress --no-scripts --no-suggest --profile - - IF %dependencies%==highest composer update --prefer-dist --no-progress --no-scripts --no-suggest --profile + - IF %dependencies%==lowest composer update --prefer-dist --prefer-lowest --prefer-stable --no-progress --no-scripts --no-suggest --profile --ignore-platform-req=php+ + - IF %dependencies%==highest composer update --prefer-dist --no-progress --no-scripts --no-suggest --profile --ignore-platform-req=php+ - git config --global user.email "doesntmatter@dispostable.com" - git config --global user.name "GrumPHP" - git config --global protocol.file.allow always diff --git a/composer.json b/composer.json index 6ac54420..d1ec7611 100644 --- a/composer.json +++ b/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": "^8.1", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", "ext-json": "*", - "composer-plugin-api": "~2.0", + "composer-plugin-api": "^2.0", "amphp/amp": "^3.0", "amphp/parallel": "^2.1", "doctrine/collections": "^1.6.8 || ^2.0", @@ -25,22 +25,22 @@ "monolog/monolog": "^2.0 || ^3.0", "ondram/ci-detector": "^4.0", "psr/container": "^1.1 || ^2.0", - "seld/jsonlint": "~1.8", - "symfony/config": "~5.4 || ~6.0", - "symfony/console": "~5.4 || ~6.0", - "symfony/dependency-injection": "~5.4 || ~6.0", - "symfony/dotenv": "~5.4 || ~6.0", - "symfony/event-dispatcher": "~5.4 || ~6.0", - "symfony/filesystem": "~5.4 || ~6.0", - "symfony/finder": "~5.4 || ~6.0", - "symfony/options-resolver": "~5.4 || ~6.0", - "symfony/process": "~5.4 || ~6.0", - "symfony/yaml": "~5.4 || ~6.0" + "seld/jsonlint": "^1.8", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "brianium/paratest": "^6.4", "composer/composer": "^2.2.6", - "nikic/php-parser": "~4.13", + "nikic/php-parser": "^4.13", "php-parallel-lint/php-parallel-lint": "^1.3", "phpspec/phpspec": "^7.2", "phpspec/prophecy-phpunit": "^2.0", diff --git a/phive.xml b/phive.xml index f0fd210f..24b421d7 100644 --- a/phive.xml +++ b/phive.xml @@ -1,7 +1,7 @@ - - - - + + + + diff --git a/src/Configuration/Loader/DistFileLoader.php b/src/Configuration/Loader/DistFileLoader.php index ada07a1f..4806cd7b 100644 --- a/src/Configuration/Loader/DistFileLoader.php +++ b/src/Configuration/Loader/DistFileLoader.php @@ -18,9 +18,9 @@ public function __construct(LoaderInterface $loader) $this->loader = $loader; } - public function load(mixed $resource, string $type = null): void + public function load(mixed $resource, string $type = null): mixed { - $this->loader->load($resource, $type); + return $this->loader->load($resource, $type); } public function supports(mixed $resource, string $type = null): bool diff --git a/src/Parser/Php/Visitor/NoExitStatementsVisitor.php b/src/Parser/Php/Visitor/NoExitStatementsVisitor.php index 305843cd..33ac99ca 100644 --- a/src/Parser/Php/Visitor/NoExitStatementsVisitor.php +++ b/src/Parser/Php/Visitor/NoExitStatementsVisitor.php @@ -16,7 +16,7 @@ public function leaveNode(Node $node): void } $this->addError( - sprintf('Found a forbidden exit statement.'), + 'Found a forbidden exit statement.', $node->getLine(), ParseError::TYPE_ERROR ); diff --git a/src/Task/CloverCoverage.php b/src/Task/CloverCoverage.php index 0c771885..9315a360 100644 --- a/src/Task/CloverCoverage.php +++ b/src/Task/CloverCoverage.php @@ -97,8 +97,8 @@ public function run(ContextInterface $context): TaskResultInterface } $xml = new SimpleXMLElement($this->filesystem->readFromFileInfo(new SplFileInfo($cloverFile))); - $totalElements = (int) current($xml->xpath('/coverage/project/metrics/@elements')); - $checkedElements = (int) current($xml->xpath('/coverage/project/metrics/@coveredelements')); + $totalElements = (int) current($xml->xpath('/coverage/project/metrics/@elements') ?? []); + $checkedElements = (int) current($xml->xpath('/coverage/project/metrics/@coveredelements') ?? []); if (0 === $totalElements) { return TaskResult::createSkipped($this, $context); diff --git a/src/Task/Git/CommitMessage.php b/src/Task/Git/CommitMessage.php index 667fc692..461c3376 100644 --- a/src/Task/Git/CommitMessage.php +++ b/src/Task/Git/CommitMessage.php @@ -231,6 +231,7 @@ private function enforceTextWidth(GitCommitMsgContext $context): TaskResult private function runMatcher(array $config, string $commitMessage, string $rule, string $ruleName): void { + assert($rule !== ''); $regex = new Regex($rule); if ((bool) $config['case_insensitive']) { diff --git a/src/Util/Regex.php b/src/Util/Regex.php index 3545a766..7cc4a708 100644 --- a/src/Util/Regex.php +++ b/src/Util/Regex.php @@ -15,12 +15,13 @@ class Regex const ALLOWED_MODIFIERS = 'imsxuADU'; /** - * @var string + * @var non-empty-string */ protected $regex; /** * Regex constructor. + * @param non-empty-string $string */ public function __construct(string $string) { @@ -50,8 +51,13 @@ private function isRegex(string $string): bool return false; } + /** + * @param non-empty-string $string + * @return non-empty-string + */ private function toRegex(string $string): string { + /** @var non-empty-string */ return $this->isRegex($string) ? $string : Glob::toRegex($string); } @@ -77,6 +83,7 @@ public function addPatternModifier(string $modifier): void /** * Returns the new regex. + * @return non-empty-string */ public function __toString(): string { diff --git a/tools/composer-normalize b/tools/composer-normalize index c207b6ea..977d97a4 100755 Binary files a/tools/composer-normalize and b/tools/composer-normalize differ diff --git a/tools/phpcbf b/tools/phpcbf index af51ecc8..ac4355c9 100755 Binary files a/tools/phpcbf and b/tools/phpcbf differ diff --git a/tools/phpcs b/tools/phpcs index 193e0a31..9aa99148 100755 Binary files a/tools/phpcs and b/tools/phpcs differ diff --git a/tools/psalm b/tools/psalm index 673e2aaa..2e4956ac 100755 Binary files a/tools/psalm and b/tools/psalm differ