Skip to content

Commit

Permalink
GrumPHP on PHP83
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Nov 24, 2023
1 parent 78591c8 commit a9cad9a
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
8 changes: 5 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "[email protected]"
- git config --global user.name "GrumPHP"
- git config --global protocol.file.allow always
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
"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"
},
"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",
Expand Down
8 changes: 4 additions & 4 deletions phive.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="psalm" version="^5.9.0" installed="5.9.0" location="./tools/psalm" copy="true"/>
<phar name="phpcs" version="^3.6.1" installed="3.6.2" location="./tools/phpcs" copy="true"/>
<phar name="phpcbf" version="^3.6.1" installed="3.6.2" location="./tools/phpcbf" copy="true"/>
<phar name="composer-normalize" version="^2.16.0" installed="2.24.1" location="./tools/composer-normalize" copy="true"/>
<phar name="psalm" version="^5.9.0" installed="5.16.0" location="./tools/psalm" copy="true"/>
<phar name="phpcs" version="^3.6.1" installed="3.7.2" location="./tools/phpcs" copy="true"/>
<phar name="phpcbf" version="^3.6.1" installed="3.7.2" location="./tools/phpcbf" copy="true"/>
<phar name="composer-normalize" version="^2.16.0" installed="2.39.0" location="./tools/composer-normalize" copy="true"/>
</phive>
2 changes: 1 addition & 1 deletion src/Parser/Php/Visitor/NoExitStatementsVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
4 changes: 2 additions & 2 deletions src/Task/CloverCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Task/Git/CommitMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down
9 changes: 8 additions & 1 deletion src/Util/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}

Expand All @@ -77,6 +83,7 @@ public function addPatternModifier(string $modifier): void

/**
* Returns the new regex.
* @return non-empty-string
*/
public function __toString(): string
{
Expand Down
Binary file modified tools/composer-normalize
Binary file not shown.
Binary file modified tools/phpcbf
Binary file not shown.
Binary file modified tools/phpcs
Binary file not shown.
Binary file modified tools/psalm
Binary file not shown.

0 comments on commit a9cad9a

Please sign in to comment.