Skip to content

Commit

Permalink
[4.3] Support PHP 8.2 (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Oct 15, 2022
1 parent 888448c commit c349cad
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 31 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/static.yml
Expand Up @@ -7,28 +7,28 @@ on:
jobs:
phpstan_src:
name: PHPStan Source
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install PHPStan
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand All @@ -39,28 +39,28 @@ jobs:

phpstan_tests:
name: PHPStan Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install PHPStan
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand All @@ -71,28 +71,28 @@ jobs:

psalm:
name: Psalm
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install Psalm
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Expand Up @@ -7,15 +7,15 @@ on:
jobs:
tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -28,7 +28,7 @@ jobs:
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
14 changes: 7 additions & 7 deletions Makefile
@@ -1,21 +1,21 @@
install:
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base bin all update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base bin all update

phpunit:
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.2-cli

phpstan-analyze-src:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze src -c phpstan.src.neon.dist
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze src -c phpstan.src.neon.dist

phpstan-analyze-tests:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze tests -c phpstan.tests.neon.dist
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze tests -c phpstan.tests.neon.dist

psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.2-cli

psalm-show-info:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.2-cli --show-info=true

test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -24,7 +24,7 @@
"ext-filter": "*",
"ext-pcre": "*",
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21"
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.30"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion phpstan.src.neon.dist
Expand Up @@ -3,7 +3,6 @@ parameters:
ignoreErrors:
- '#Call to function is_string\(\) with string will always evaluate to true.#'
- '#Variable \$defaults might not be defined.#'
- '#Method Dotenv\\Regex\\Regex::split\(\) should return Dotenv\\Result\\Result\<array\<string\>, string\> but returns Dotenv\\Result\\Result\<array\<int, bool\|string\>, string\>.#'
- '/^Parameter \#1 \$readers of class Dotenv\\Repository\\[a-zA-Z]*Repository[a-zA-Z]* constructor expects/'
- '/^Parameter \#2 \$writers of class Dotenv\\Repository\\[a-zA-Z]*Repository[a-zA-Z]* constructor expects/'
- '#Parameter \#1 \$name of method Dotenv\\Repository\\AbstractRepository::set\(\) expects string, string\|null given.#'
2 changes: 2 additions & 0 deletions src/Regex/Regex.php
Expand Up @@ -88,9 +88,11 @@ private static function pregAndWrap(callable $operation, $subject)
$result = $operation($subject);

if (($e = preg_last_error()) !== PREG_NO_ERROR) {
/** @var Result<V,string> */
return Error::create(self::lookupError($e));
}

/** @var Result<V,string> */
return Success::create($result);
}

Expand Down
5 changes: 3 additions & 2 deletions vendor-bin/phpstan/composer.json
@@ -1,9 +1,10 @@
{
"require": {
"phpstan/phpstan": "1.2.0",
"php": "^8.2",
"phpstan/phpstan": "1.8.9",
"phpstan/extension-installer": "1.1.0",
"phpstan/phpstan-deprecation-rules": "1.0.0",
"phpstan/phpstan-strict-rules": "1.1.0",
"phpstan/phpstan-strict-rules": "1.4.4",
"thecodingmachine/phpstan-strict-rules": "1.0.0"
},
"config": {
Expand Down
3 changes: 2 additions & 1 deletion vendor-bin/psalm/composer.json
@@ -1,6 +1,7 @@
{
"require": {
"psalm/phar": "4.19.0"
"php": "^8.2",
"psalm/phar": "4.29.0"
},
"config": {
"preferred-install": "dist"
Expand Down

0 comments on commit c349cad

Please sign in to comment.