Skip to content

Commit

Permalink
PHP 8.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Nov 12, 2023
1 parent dd3a383 commit 80735db
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 128 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
/.travis.yml export-ignore
/Makefile export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.src.neon.dist export-ignore
/phpstan.tests.neon.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/README.md export-ignore
Expand Down
48 changes: 7 additions & 41 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ on:
pull_request:

jobs:
phpstan_src:
name: PHPStan Source
phpstan:
name: PHPStan
runs-on: ubuntu-22.04

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
tools: composer:v2
coverage: none
env:
Expand All @@ -37,54 +37,20 @@ jobs:
command: composer bin phpstan update --no-interaction --no-progress

- name: Execute PHPStan
run: vendor/bin/phpstan analyze src -c phpstan.src.neon.dist --no-progress

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2
coverage: none
env:
update: true

- name: Install Dependencies
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@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer bin phpstan update --no-interaction --no-progress

- name: Execute PHPStan
run: vendor/bin/phpstan analyze tests -c phpstan.tests.neon.dist --no-progress
run: vendor/bin/phpstan analyze --no-progress

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
tools: composer:v2
coverage: none
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:

strategy:
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
install:
@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
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.3-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.3-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:8.2-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.3-cli

phpstan-analyze-src:
@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:8.2-cli analyze tests -c phpstan.tests.neon.dist
phpstan-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.3-cli analyze

phpstan-baseline:
@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 --generate-baseline
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.3-cli analyze --generate-baseline

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

psalm-baseline:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.3-cli --set-baseline=psalm-baseline.xml

psalm-show-info:
@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
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.3-cli --show-info=true

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

clean:
@rm -rf .phpunit.result.cache composer.lock vendor vendor-bin/*/composer.lock vendor-bin/*/vendor
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.32 || ^9.6.3 || ^10.0.12"
"phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ parameters:
count: 1
path: src/PhpOption/Option.php

-
message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#"
count: 1
path: src/PhpOption/Option.php

-
message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) should return PhpOption\\\\LazyOption\\<S\\> but returns PhpOption\\\\LazyOption\\<mixed\\>\\.$#"
count: 1
Expand Down
8 changes: 8 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- phpstan-baseline.neon

parameters:
level: max
paths:
- src
checkGenericClassInNonGenericObjectType: false
11 changes: 0 additions & 11 deletions phpstan.src.neon.dist

This file was deleted.

57 changes: 0 additions & 57 deletions phpstan.tests.neon.dist

This file was deleted.

2 changes: 1 addition & 1 deletion vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"phpstan/phpstan": "1.10.3"
"phpstan/phpstan": "1.10.41"
},
"config": {
"preferred-install": "dist"
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"psalm/phar": "5.7.6"
"psalm/phar": "5.15.0"
},
"config": {
"preferred-install": "dist"
Expand Down

0 comments on commit 80735db

Please sign in to comment.