Skip to content

Commit 0de3d3a

Browse files
committed
Drop PHP 8.0, support PHP 8.3
1 parent 81ca350 commit 0de3d3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+305
-277
lines changed

.github/workflows/build.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php-version:
15-
- "8.0"
1615
- "8.1"
1716
- "8.2"
17+
- "8.3"
1818
os:
1919
- ubuntu-latest
2020
- macOS-latest
@@ -37,6 +37,9 @@ jobs:
3737
coverage: xdebug
3838
ini-values: error_reporting=E_ALL
3939

40+
- name: Install PHIVE
41+
uses: szepeviktor/phive@v1
42+
4043
- name: Install dependencies
4144
run: composer update
4245
--prefer-dist
@@ -45,3 +48,18 @@ jobs:
4548

4649
- name: Run tests
4750
run: composer test
51+
52+
- name: Run Infection
53+
run: composer infection
54+
env:
55+
INFECTION_DASHBOARD_API_KEY: ${{ secrets.INFECTION_DASHBOARD_API_KEY }}
56+
57+
- name: Upload coverage to Codecov.io
58+
run: bash <(curl -s https://codecov.io/bash -s "build/logs")
59+
continue-on-error: true
60+
61+
- name: Upload coverage to Scrutinizer
62+
uses: sudo-bot/action-scrutinizer@latest
63+
with:
64+
cli-args: --format=php-clover build/logs/clover.xml
65+
continue-on-error: true

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/build/
22
/vendor/
33
/composer.lock
4+
/tools/
5+
/vendor-bin/**/vendor/
6+
/vendor-bin/**/composer.lock
47
/phpunit.xml
58
/infection.json
69
.phpunit.result.cache

.phive/phars.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="infection" version="^0.27.10" installed="0.27.10" location="./tools/infection" copy="true"/>
4+
</phive>

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ 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+
## [Unreleased]
8+
### Removed
9+
- Dropped PHP 8.0 support.
10+
### Added
11+
- Added PHP 8.3 support.
12+
713
## [0.6.0] - 2023-09-19
814
### Removed
915
- Dropped PHP 7 support.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016-2023 Edward Surov
3+
Copyright (c) 2016-2024 Edward Surov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
[![Build](https://github.com/remorhaz/php-json-patch/actions/workflows/build.yml/badge.svg)](https://github.com/remorhaz/php-json-patch/actions/workflows/build.yml)
55
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/remorhaz/php-json-patch/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/remorhaz/php-json-patch/?branch=master)
66
[![codecov](https://codecov.io/gh/remorhaz/php-json-patch/branch/master/graph/badge.svg)](https://codecov.io/gh/remorhaz/php-json-patch)
7-
[![Infection MSI](https://badge.stryker-mutator.io/github.com/remorhaz/php-json-patch/master)](https://infection.github.io)
8-
[![Total Downloads](https://poser.pugx.org/remorhaz/php-json-patch/downloads)](https://packagist.org/packages/remorhaz/php-json-patch)
7+
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.heygears.com%2Fremorhaz%2Fphp-json-patch%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/remorhaz/php-json-patch/master)[![Total Downloads](https://poser.pugx.org/remorhaz/php-json-patch/downloads)](https://packagist.org/packages/remorhaz/php-json-patch)
98
[![License](https://poser.pugx.org/remorhaz/php-json-patch/license)](https://packagist.org/packages/remorhaz/php-json-patch)
109

1110
This library implements [RFC6902](https://tools.ietf.org/html/rfc6902)-compliant JSON patch tool.
1211

1312
## Requirements
14-
- PHP 8.0+
13+
- PHP 8.1.
1514
- [JSON extension](https://www.php.net/manual/en/book.json.php) (ext-json) - required by [remorhaz/php-json-data](https://github.com/remorhaz/php-json-data) to access JSON documents.
1615
- [Internationalization functions](https://www.php.net/manual/en/book.intl.php) (ext-intl) - required by [`remorhaz/php-json-data`](https://github.com/remorhaz/php-json-data) to compare Unicode strings.
1716

composer.json

+19-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
}
1717
],
1818
"require": {
19-
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
19+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
2020
"ext-intl": "*",
21-
"remorhaz/php-json-data": "^0.6",
22-
"remorhaz/php-json-pointer": "^0.7"
21+
"remorhaz/php-json-data": "^0.7",
22+
"remorhaz/php-json-pointer": "^0.7.1"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^9.6.13 || ^10",
26-
"infection/infection": "^0.26.19 || ^0.27.2",
27-
"squizlabs/php_codesniffer": "^3.7.2"
25+
"bamarni/composer-bin-plugin": "^1.8.2",
26+
"phpunit/phpunit": "^10.1 || ^11"
2827
},
2928
"autoload": {
3029
"psr-4": {
@@ -37,8 +36,13 @@
3736
}
3837
},
3938
"scripts": {
39+
"post-update-cmd": ["@phive-install"],
40+
"post-install-cmd": ["@phive-install"],
41+
"phive-install": [
42+
"`if [ -f tools/phive ]; then echo 'tools/'; fi`phive install --trust-gpg-keys C5095986493B4AA0"
43+
],
4044
"test-cs": [
41-
"vendor/bin/phpcs"
45+
"vendor-bin/cs/vendor/bin/phpcs -sp"
4246
],
4347
"test-unit": [
4448
"vendor/bin/phpunit --coverage-xml=build/logs/coverage-xml --log-junit=build/logs/junit.xml"
@@ -50,12 +54,18 @@
5054
"infection": [
5155
"@test-unit",
5256
"mkdir -p build/logs/infection",
53-
"vendor/bin/infection --threads=4 --coverage=build/logs --no-progress --skip-initial-tests"
57+
"tools/infection --threads=4 --coverage=build/logs --no-progress --skip-initial-tests"
5458
]
5559
},
5660
"config": {
5761
"allow-plugins": {
58-
"infection/extension-installer": true
62+
"bamarni/composer-bin-plugin": true
63+
}
64+
},
65+
"extra": {
66+
"bamarni-bin": {
67+
"bin-links": false,
68+
"forward-command": true
5969
}
6070
}
6171
}

docker-compose.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ services:
44
php:
55
build:
66
context: .
7-
dockerfile: php-8.0.Dockerfile
7+
dockerfile: php-8.1.Dockerfile
8+
volumes:
9+
- .:/app
10+
working_dir: /app
11+
php8.2:
12+
build:
13+
context: .
14+
dockerfile: php-8.2.Dockerfile
15+
volumes:
16+
- .:/app
17+
working_dir: /app
18+
php8.3:
19+
build:
20+
context: .
21+
dockerfile: php-8.3.Dockerfile
822
volumes:
923
- .:/app
1024
working_dir: /app

infection.json.dist

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"text": "build/logs/infection/infection.log",
1010
"summary": "build/logs/infection/summary.log",
1111
"perMutator": "build/logs/infection/per-mutator.md",
12-
"badge": {
13-
"branch": "master"
12+
"stryker": {
13+
"badge": "/^master$/"
1414
}
1515
}
1616
}

php-8.0.Dockerfile

-18
This file was deleted.

php-8.1.Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM php:8.1-cli
2+
3+
RUN apt-get update && apt-get install -y \
4+
zip \
5+
git \
6+
wget \
7+
gpg \
8+
libicu-dev && \
9+
pecl install xdebug && \
10+
docker-php-ext-enable xdebug && \
11+
docker-php-ext-configure intl --enable-intl && \
12+
docker-php-ext-install intl pcntl && \
13+
echo "xdebug.mode = develop,coverage,debug" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"
14+
15+
ENV COMPOSER_ALLOW_SUPERUSER=1 \
16+
COMPOSER_PROCESS_TIMEOUT=1200
17+
18+
RUN curl --silent --show-error https://getcomposer.org/installer | php -- \
19+
--install-dir=/usr/bin --filename=composer && \
20+
git config --global --add safe.directory "*"
21+
22+
RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
23+
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
24+
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
25+
gpg --verify phive.phar.asc phive.phar && \
26+
chmod +x phive.phar && \
27+
mv phive.phar /usr/local/bin/phive \

php-8.2.Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM php:8.2-cli
2+
3+
RUN apt-get update && apt-get install -y \
4+
zip \
5+
git \
6+
wget \
7+
gpg \
8+
libicu-dev && \
9+
pecl install xdebug && \
10+
docker-php-ext-enable xdebug && \
11+
docker-php-ext-configure intl --enable-intl && \
12+
docker-php-ext-install intl pcntl && \
13+
echo "xdebug.mode = develop,coverage,debug" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"
14+
15+
ENV COMPOSER_ALLOW_SUPERUSER=1 \
16+
COMPOSER_PROCESS_TIMEOUT=1200
17+
18+
RUN curl --silent --show-error https://getcomposer.org/installer | php -- \
19+
--install-dir=/usr/bin --filename=composer && \
20+
git config --global --add safe.directory "*"
21+
22+
RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
23+
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
24+
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
25+
gpg --verify phive.phar.asc phive.phar && \
26+
chmod +x phive.phar && \
27+
mv phive.phar /usr/local/bin/phive \

php-8.3.Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM php:8.3-cli
2+
3+
RUN apt-get update && apt-get install -y \
4+
zip \
5+
git \
6+
wget \
7+
gpg \
8+
libicu-dev && \
9+
pecl install xdebug && \
10+
docker-php-ext-enable xdebug && \
11+
docker-php-ext-configure intl --enable-intl && \
12+
docker-php-ext-install intl pcntl && \
13+
echo "xdebug.mode = develop,coverage,debug" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"
14+
15+
ENV COMPOSER_ALLOW_SUPERUSER=1 \
16+
COMPOSER_PROCESS_TIMEOUT=1200
17+
18+
RUN curl --silent --show-error https://getcomposer.org/installer | php -- \
19+
--install-dir=/usr/bin --filename=composer && \
20+
git config --global --add safe.directory "*"
21+
22+
RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
23+
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
24+
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
25+
gpg --verify phive.phar.asc phive.phar && \
26+
chmod +x phive.phar && \
27+
mv phive.phar /usr/local/bin/phive \

phpunit.xml.dist

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
<?xml version="1.0" encoding="UTF-8" ?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
5-
forceCoversAnnotation="true"
6-
colors="true"
7-
defaultTestSuite="unit">
8-
<testsuites>
9-
<testsuite name="unit">
10-
<directory>tests/</directory>
11-
</testsuite>
12-
</testsuites>
13-
<coverage processUncoveredFiles="true">
14-
<include>
15-
<directory suffix=".php">src/</directory>
16-
</include>
17-
</coverage>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
5+
colors="true"
6+
defaultTestSuite="unit"
7+
cacheDirectory="build/.phpunit.cache"
8+
requireCoverageMetadata="true">
9+
<testsuites>
10+
<testsuite name="unit">
11+
<directory>tests/</directory>
12+
</testsuite>
13+
</testsuites>
14+
<source>
15+
<include>
16+
<directory>src/</directory>
17+
</include>
18+
</source>
1819
</phpunit>

src/Operation/AddOperation.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
final class AddOperation implements OperationInterface
1212
{
1313
public function __construct(
14-
private int $index,
15-
private PointerQueryInterface $pathPointer,
16-
private NodeValueInterface $value,
14+
private readonly int $index,
15+
private readonly PointerQueryInterface $pathPointer,
16+
private readonly NodeValueInterface $value,
1717
) {
1818
}
1919

src/Operation/CopyOperation.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
final class CopyOperation implements OperationInterface
1212
{
1313
public function __construct(
14-
private int $index,
15-
private PointerQueryInterface $pathPointer,
16-
private PointerQueryInterface $fromPointer,
14+
private readonly int $index,
15+
private readonly PointerQueryInterface $pathPointer,
16+
private readonly PointerQueryInterface $fromPointer,
1717
) {
1818
}
1919

src/Operation/Exception/InvalidOperationCodeException.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
final class InvalidOperationCodeException extends UnexpectedValueException implements ExceptionInterface
1111
{
1212
public function __construct(
13-
private int $index,
14-
private mixed $operationCode,
13+
private readonly int $index,
14+
private readonly mixed $operationCode,
1515
?Throwable $previous = null,
1616
) {
1717
parent::__construct(
18-
"Operation #$this->index: operation code in 'op' property must be a string",
19-
0,
20-
$previous,
18+
message: "Operation #$this->index: operation code in 'op' property must be a string",
19+
previous: $previous,
2120
);
2221
}
2322

src/Operation/Exception/InvalidPathException.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
final class InvalidPathException extends UnexpectedValueException implements ExceptionInterface
1111
{
1212
public function __construct(
13-
private int $index,
14-
private string $property,
15-
private mixed $path,
13+
private readonly int $index,
14+
private readonly string $property,
15+
private readonly mixed $path,
1616
?Throwable $previous = null,
1717
) {
1818
parent::__construct(
19-
"Operation #$this->index: JSON pointer in '$this->property' property must be a string",
20-
0,
21-
$previous,
19+
message: "Operation #$this->index: JSON pointer in '$this->property' property must be a string",
20+
previous: $previous,
2221
);
2322
}
2423

0 commit comments

Comments
 (0)