Skip to content

Commit 55722e2

Browse files
committed
Dropped PHP 8.0, supported PHP 8.3
1 parent af247e2 commit 55722e2

File tree

65 files changed

+633
-616
lines changed

Some content is hidden

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

65 files changed

+633
-616
lines changed

.github/workflows/build.yml

+4-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
@@ -36,6 +36,9 @@ jobs:
3636
coverage: xdebug
3737
ini-values: error_reporting=E_ALL
3838

39+
- name: Install PHIVE
40+
uses: szepeviktor/phive@v1
41+
3942
- name: Install dependencies
4043
run: composer update
4144
--prefer-dist

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/build/
22
/vendor/
33
/composer.lock
4+
/tools/
5+
/vendor-bin/**/vendor/
6+
/vendor-bin/**/composer.lock
47
.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.9" installed="0.27.9" 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.7.0] - 2023-09-19
814
### Removed
915
- Dropped PHP 7 support.

composer.json

+21-10
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
}
1818
],
1919
"require": {
20-
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
21-
"remorhaz/php-json-data": "^0.6",
22-
"remorhaz/php-unilex": "^0.5.2"
20+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
21+
"remorhaz/php-json-data": "^0.7",
22+
"remorhaz/php-unilex": "^0.5.3"
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",
26+
"phpunit/phpunit": "^10.1 || ^11"
2827
},
2928
"autoload": {
3029
"psr-4": {
@@ -43,13 +42,18 @@
4342
"remorhaz/php-json-patch": "Uses JSON Pointers to implement the declarative way of altering JSON data (RFC-6902)"
4443
},
4544
"scripts": {
45+
"post-update-cmd": ["@phive-install"],
46+
"post-install-cmd": ["@phive-install"],
47+
"phive-install": [
48+
"`if [ -f tools/phive ]; then echo 'tools/'; fi`phive install --trust-gpg-keys C5095986493B4AA0"
49+
],
4650
"build": [
4751
"vendor/bin/unilex build-token-matcher --desc=\"JSON Pointer token matcher.\" spec/LexerSpec.php generated/TokenMatcher.php",
4852
"vendor/bin/unilex build-lookup-table --type=LL_1 --symbol=Remorhaz\\\\JSON\\\\Pointer\\\\Parser\\\\SymbolType --token=Remorhaz\\\\JSON\\\\Pointer\\\\Parser\\\\TokenType --desc=\"JSON Pointer parser LL(1) lookup table.\" spec/GrammarSpec.php generated/LookupTable.php",
49-
"vendor/bin/phpcbf -p generated/; if [ $? -eq 1 ]; then exit 0; fi"
53+
"vendor-bin/cs/vendor/bin/phpcbf -p generated/; if [ $? -eq 1 ]; then exit 0; fi"
5054
],
5155
"test-cs": [
52-
"vendor/bin/phpcs -sp"
56+
"vendor-bin/cs/vendor/bin/phpcs -sp"
5357
],
5458
"test-unit": [
5559
"vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --coverage-xml=build/logs/coverage-xml --log-junit=build/logs/junit.xml"
@@ -61,12 +65,19 @@
6165
"infection": [
6266
"@test-unit",
6367
"mkdir -p ./build/logs",
64-
"vendor/bin/infection --coverage=build/logs --threads=4 --no-progress --skip-initial-tests"
68+
"tools/infection --coverage=build/logs --threads=4 --no-progress --skip-initial-tests"
6569
]
6670
},
6771
"config": {
6872
"allow-plugins": {
69-
"infection/extension-installer": true
73+
"bamarni/composer-bin-plugin": true
74+
},
75+
"sort-packages": true
76+
},
77+
"extra": {
78+
"bamarni-bin": {
79+
"bin-links": false,
80+
"forward-command": true
7081
}
7182
}
7283
}

docker-compose.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ services:
44
php:
55
build:
66
context: .
7-
dockerfile: php-8.0.Dockerfile
7+
dockerfile: php-8.1.Dockerfile
88
volumes:
99
- .:/app
1010
working_dir: /app
11-
php8.0:
11+
php8.2:
1212
build:
1313
context: .
14-
dockerfile: php-8.0.Dockerfile
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
1522
volumes:
1623
- .:/app
1724
working_dir: /app

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

+21-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
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-
defaultTestSuite="all"
7-
colors="true">
8-
<testsuites>
9-
<testsuite name="all">
10-
<directory>tests/</directory>
11-
</testsuite>
12-
</testsuites>
13-
<coverage processUncoveredFiles="true">
14-
<include>
15-
<directory suffix=".php">src/</directory>
16-
<directory suffix=".php">generated/</directory>
17-
</include>
18-
<exclude>
19-
<file>generated/LookupTable.php</file>
20-
</exclude>
21-
</coverage>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
5+
defaultTestSuite="all"
6+
colors="true"
7+
cacheDirectory="build/.phpunit.cache"
8+
requireCoverageMetadata="true">
9+
<testsuites>
10+
<testsuite name="all">
11+
<directory>tests/</directory>
12+
</testsuite>
13+
</testsuites>
14+
<source>
15+
<include>
16+
<directory>src/</directory>
17+
<directory>generated/</directory>
18+
</include>
19+
<exclude>
20+
<file>generated/LookupTable.php</file>
21+
</exclude>
22+
</source>
2223
</phpunit>

src/Locator/Exception/LocatorAlreadyBuiltException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ final class LocatorAlreadyBuiltException extends LogicException implements Excep
1111
{
1212
public function __construct(?Throwable $previous = null)
1313
{
14-
parent::__construct("Locator is already built", 0, $previous);
14+
parent::__construct("Locator is already built", previous: $previous);
1515
}
1616
}

src/Locator/IndexReference.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
final class IndexReference implements IndexReferenceInterface
88
{
99
public function __construct(
10-
private int $elementIndex,
10+
private readonly int $elementIndex,
1111
) {
1212
}
1313

src/Locator/ListedReference.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
final class ListedReference implements ListedReferenceInterface
88
{
99
public function __construct(
10-
private ReferenceInterface $reference,
11-
private bool $isLast,
10+
private readonly ReferenceInterface $reference,
11+
private readonly bool $isLast,
1212
) {
1313
}
1414

src/Locator/Locator.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ final class Locator implements LocatorInterface
1212
/**
1313
* @var list<ListedReferenceInterface>
1414
*/
15-
private array $listedReferences;
15+
private readonly array $listedReferences;
1616

1717
public function __construct(ReferenceInterface ...$references)
18+
{
19+
$this->listedReferences = $this->buildListedReferences(...$references);
20+
}
21+
22+
23+
private function buildListedReferences(ReferenceInterface ...$references): array
1824
{
1925
$listSize = count($references);
20-
$this->listedReferences = [];
26+
$listedReferences = [];
2127
foreach (array_values($references) as $index => $reference) {
22-
$this->listedReferences[] = new ListedReference($reference, $index + 1 == $listSize);
28+
$listedReferences[] = new ListedReference($reference, $index + 1 == $listSize);
2329
}
30+
31+
return $listedReferences;
2432
}
2533

2634
/**

src/Locator/LocatorBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function create(): LocatorBuilderInterface
2323
}
2424

2525
public function __construct(
26-
private ReferenceFactoryInterface $referenceFactory,
26+
private readonly ReferenceFactoryInterface $referenceFactory,
2727
) {
2828
}
2929

src/Locator/PropertyReference.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
final class PropertyReference implements ReferenceInterface
88
{
99
public function __construct(
10-
private string $propertyName,
10+
private readonly string $propertyName,
1111
) {
1212
}
1313

src/Parser/Exception/LL1ParserNotCreatedException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ final class LL1ParserNotCreatedException extends LogicException implements Excep
1111
{
1212
public function __construct(?Throwable $previous = null)
1313
{
14-
parent::__construct("Failed to create LL(1) parser", 0, $previous);
14+
parent::__construct("Failed to create LL(1) parser", previous: $previous);
1515
}
1616
}

src/Parser/Parser.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public static function create(): ParserInterface
2121
}
2222

2323
public function __construct(
24-
private Ll1ParserFactoryInterface $ll1ParserFactory,
25-
private ReferenceFactoryInterface $referenceFactory,
24+
private readonly Ll1ParserFactoryInterface $ll1ParserFactory,
25+
private readonly ReferenceFactoryInterface $referenceFactory,
2626
) {
2727
}
2828

src/Parser/TranslationScheme.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
final class TranslationScheme implements TranslationSchemeInterface
1414
{
1515
public function __construct(
16-
private LocatorBuilderInterface $locatorBuilder,
16+
private readonly LocatorBuilderInterface $locatorBuilder,
1717
) {
1818
}
1919

src/Processor/Mutator/AppendElementMutation.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ final class AppendElementMutation implements MutationInterface
1919
private int $elementCounter = 0;
2020

2121
public function __construct(
22-
private NodeValueInterface $value,
23-
private PathInterface $path,
24-
private ?int $elementIndex = null,
22+
private readonly NodeValueInterface $value,
23+
private readonly PathInterface $path,
24+
private readonly ?int $elementIndex = null,
2525
) {
2626
}
2727

0 commit comments

Comments
 (0)