Skip to content

Commit d223be0

Browse files
authored
Prepare for PHP 8.1 (#42)
1 parent f373420 commit d223be0

15 files changed

+588
-81
lines changed

.github/workflows/cloc.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: cloc
2+
on:
3+
pull_request:
4+
jobs:
5+
cloc:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout code
9+
uses: actions/checkout@v2
10+
with:
11+
path: pr
12+
- name: Checkout base code
13+
uses: actions/checkout@v2
14+
with:
15+
ref: ${{ github.event.pull_request.base.sha }}
16+
path: base
17+
- name: Count Lines Of Code
18+
id: loc
19+
run: |
20+
curl -OL https://github.com/vearutop/sccdiff/releases/download/v1.0.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
21+
OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
22+
OUTPUT="${OUTPUT//'%'/'%25'}"
23+
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
24+
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
25+
echo "::set-output name=diff::$OUTPUT"
26+
27+
- name: Comment Code Lines
28+
uses: marocchino/sticky-pull-request-comment@v2
29+
with:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
header: LOC
32+
message: |
33+
### Lines Of Code
34+
35+
${{ steps.loc.outputs.diff }}

.github/workflows/lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: lint
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
pull_request:
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.operating-system }}
11+
strategy:
12+
matrix:
13+
operating-system: [ 'ubuntu-latest' ]
14+
php-versions: [ '7.4' ]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Cache vendor
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
vendor
24+
key: vendor-${{ hashFiles('composer.lock') }}
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
ini-values: post_max_size=256M, max_execution_time=180
31+
tools: composer
32+
33+
- name: Populate vendor
34+
run: '[ -e vendor ] || composer install'
35+
36+
- name: Lint
37+
run: make lint

.github/workflows/test-unit-cov.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: test-unit-cov
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
pull_request:
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.operating-system }}
11+
strategy:
12+
matrix:
13+
operating-system: [ 'ubuntu-latest' ]
14+
php-versions: [ '7.4' ]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Cache vendor
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
vendor
24+
key: deps-${{ hashFiles('composer.lock') }}
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
ini-values: post_max_size=256M, max_execution_time=180
31+
coverage: xdebug
32+
tools: composer
33+
34+
- name: Populate vendor
35+
run: '[ -e vendor ] || (composer install && patch -s -p0 < ./tests/phpunit.patch)'
36+
37+
- name: Run Tests With Coverage
38+
run: make deps test-coverage && bash <(curl -s https://codecov.io/bash)

.github/workflows/test-unit.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: test-unit
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
pull_request:
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.operating-system }}
11+
strategy:
12+
matrix:
13+
operating-system: [ 'ubuntu-latest' ]
14+
php-versions: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '8.0', '8.1' ]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Cache vendor
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
vendor
24+
key: deps-${{ hashFiles('composer.lock') }}
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
ini-values: post_max_size=256M, max_execution_time=180
31+
tools: composer
32+
33+
- name: Populate vendor
34+
run: '[ -e vendor ] || (composer install && patch -s -p0 < ./tests/phpunit.patch)'
35+
36+
- name: Run Tests
37+
run: make deps test

.gitlab-ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [3.8.2] - 2021-09-17
8+
9+
### Fixed
10+
- PHP 8.1 Deprecation notices with missing returns.
11+
712
## [3.8.1] - 2020-09-25
813

914
### Fixed
@@ -55,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5560
### Added
5661
- Compatibility option to `TOLERATE_ASSOCIATIVE_ARRAYS` that mimic JSON objects.
5762

63+
[3.8.2]: https://github.com/swaggest/json-diff/compare/v3.8.1...v3.8.2
5864
[3.8.1]: https://github.com/swaggest/json-diff/compare/v3.8.0...v3.8.1
5965
[3.8.0]: https://github.com/swaggest/json-diff/compare/v3.7.5...v3.8.0
6066
[3.7.5]: https://github.com/swaggest/json-diff/compare/v3.7.4...v3.7.5

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PHPSTAN_VERSION ?= 0.11.19
1+
PHPSTAN_VERSION ?= 0.12.99
22
PHPBENCH_VERSION ?= 0.16.10
33

44
deps:
@@ -11,11 +11,17 @@ lint:
1111
docker-lint:
1212
@docker run -v $$PWD:/app --rm phpstan/phpstan analyze -l 7 -c phpstan.neon ./src
1313

14+
docker-test-new:
15+
@docker run -v $$PWD:/app -w /app --rm php:8.1.0RC1-zts-buster php vendor/bin/phpunit --configuration phpunit.xml
16+
17+
docker-test-old:
18+
@docker run -v $$PWD:/app -w /app --rm php:5.4-cli php vendor/bin/phpunit --configuration phpunit.xml
19+
1420
test:
15-
@php -derror_reporting="E_ALL & ~E_DEPRECATED" vendor/bin/phpunit --configuration phpunit.xml
21+
@php vendor/bin/phpunit --configuration phpunit.xml
1622

1723
test-coverage:
18-
@php -derror_reporting="E_ALL & ~E_DEPRECATED" -dzend_extension=xdebug.so vendor/bin/phpunit --configuration phpunit.xml --coverage-text --coverage-clover=coverage.xml
24+
@php -dzend_extension=xdebug.so vendor/bin/phpunit --configuration phpunit.xml --coverage-text --coverage-clover=coverage.xml
1925

2026
phpbench:
2127
@test -f ${HOME}/.cache/composer/phpbench-${PHPBENCH_VERSION}.phar || (mkdir -p ${HOME}/.cache/composer/ && wget https://github.com/phpbench/phpbench/releases/download/${PHPBENCH_VERSION}/phpbench.phar -O ${HOME}/.cache/composer/phpbench-${PHPBENCH_VERSION}.phar)

phpstan.neon

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
inferPrivatePropertyTypeFromConstructor: true
3+
checkMissingIterableValueType: false
4+
checkGenericClassInNonGenericObjectType: false
5+
ignoreErrors:
6+
- '#has no return typehint specified#'
7+
- '#with no typehint specified#'
8+
- '#has no typehint specified#'

src/JsonPatch.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function import(array $data)
5555
{
5656
$result = new JsonPatch();
5757
foreach ($data as $operation) {
58-
/** @var OpPath|OpPathValue|OpPathFrom $operation */
58+
/** @var OpPath|OpPathValue|OpPathFrom|array $operation */
5959
if (is_array($operation)) {
6060
$operation = (object)$operation;
6161
}
@@ -124,6 +124,7 @@ public function op(OpPath $op)
124124
return $this;
125125
}
126126

127+
#[\ReturnTypeWillChange]
127128
public function jsonSerialize()
128129
{
129130
return self::export($this);

0 commit comments

Comments
 (0)