Skip to content

Commit

Permalink
Dropped PHP 8.0, supported PHP 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
remorhaz committed Feb 19, 2024
1 parent af247e2 commit 0d40cda
Show file tree
Hide file tree
Showing 64 changed files with 629 additions and 615 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/build/
/vendor/
/composer.lock
/tools/
/vendor-bin/**/vendor/
/vendor-bin/**/composer.lock
.phpunit.result.cache
4 changes: 4 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="infection" version="^0.27.9" installed="0.27.9" location="./tools/infection" copy="true"/>
</phive>
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Removed
- Dropped PHP 8.0 support.
### Added
- Added PHP 8.3 support.

## [0.7.0] - 2023-09-19
### Removed
- Dropped PHP 7 support.
Expand Down
31 changes: 21 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
}
],
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"remorhaz/php-json-data": "^0.6",
"remorhaz/php-unilex": "^0.5.2"
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"remorhaz/php-json-data": "^0.7",
"remorhaz/php-unilex": "^0.5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.6.13 || ^10",
"infection/infection": "^0.26.19 || ^0.27.2",
"squizlabs/php_codesniffer": "^3.7.2"
"bamarni/composer-bin-plugin": "^1.8",
"phpunit/phpunit": "^10.1 || ^11"
},
"autoload": {
"psr-4": {
Expand All @@ -43,13 +42,18 @@
"remorhaz/php-json-patch": "Uses JSON Pointers to implement the declarative way of altering JSON data (RFC-6902)"
},
"scripts": {
"post-update-cmd": ["@phive-install"],
"post-install-cmd": ["@phive-install"],
"phive-install": [
"`if [ -f tools/phive ]; then echo 'tools/'; fi`phive install --trust-gpg-keys C5095986493B4AA0"
],
"build": [
"vendor/bin/unilex build-token-matcher --desc=\"JSON Pointer token matcher.\" spec/LexerSpec.php generated/TokenMatcher.php",
"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",
"vendor/bin/phpcbf -p generated/; if [ $? -eq 1 ]; then exit 0; fi"
"vendor-bin/cs/vendor/bin/phpcbf -p generated/; if [ $? -eq 1 ]; then exit 0; fi"
],
"test-cs": [
"vendor/bin/phpcs -sp"
"vendor-bin/cs/vendor/bin/phpcs -sp"
],
"test-unit": [
"vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --coverage-xml=build/logs/coverage-xml --log-junit=build/logs/junit.xml"
Expand All @@ -61,12 +65,19 @@
"infection": [
"@test-unit",
"mkdir -p ./build/logs",
"vendor/bin/infection --coverage=build/logs --threads=4 --no-progress --skip-initial-tests"
"tools/infection --coverage=build/logs --threads=4 --no-progress --skip-initial-tests"
]
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
"bamarni/composer-bin-plugin": true
},
"sort-packages": true
},
"extra": {
"bamarni-bin": {
"bin-links": false,
"forward-command": true
}
}
}
13 changes: 10 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ services:
php:
build:
context: .
dockerfile: php-8.0.Dockerfile
dockerfile: php-8.1.Dockerfile
volumes:
- .:/app
working_dir: /app
php8.0:
php8.2:
build:
context: .
dockerfile: php-8.0.Dockerfile
dockerfile: php-8.2.Dockerfile
volumes:
- .:/app
working_dir: /app
php8.3:
build:
context: .
dockerfile: php-8.3.Dockerfile
volumes:
- .:/app
working_dir: /app
18 changes: 0 additions & 18 deletions php-8.0.Dockerfile

This file was deleted.

27 changes: 27 additions & 0 deletions php-8.1.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM php:8.1-cli

RUN apt-get update && apt-get install -y \
zip \
git \
wget \
gpg \
libicu-dev && \
pecl install xdebug && \
docker-php-ext-enable xdebug && \
docker-php-ext-configure intl --enable-intl && \
docker-php-ext-install intl pcntl && \
echo "xdebug.mode = develop,coverage,debug" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"

ENV COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_PROCESS_TIMEOUT=1200

RUN curl --silent --show-error https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer && \
git config --global --add safe.directory "*"

RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
gpg --verify phive.phar.asc phive.phar && \
chmod +x phive.phar && \
mv phive.phar /usr/local/bin/phive \
27 changes: 27 additions & 0 deletions php-8.2.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM php:8.2-cli

RUN apt-get update && apt-get install -y \
zip \
git \
wget \
gpg \
libicu-dev && \
pecl install xdebug && \
docker-php-ext-enable xdebug && \
docker-php-ext-configure intl --enable-intl && \
docker-php-ext-install intl pcntl && \
echo "xdebug.mode = develop,coverage,debug" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"

ENV COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_PROCESS_TIMEOUT=1200

RUN curl --silent --show-error https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer && \
git config --global --add safe.directory "*"

RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
gpg --verify phive.phar.asc phive.phar && \
chmod +x phive.phar && \
mv phive.phar /usr/local/bin/phive \
27 changes: 27 additions & 0 deletions php-8.3.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM php:8.3-cli

RUN apt-get update && apt-get install -y \
zip \
git \
wget \
gpg \
libicu-dev && \
pecl install xdebug && \
docker-php-ext-enable xdebug && \
docker-php-ext-configure intl --enable-intl && \
docker-php-ext-install intl pcntl && \
echo "xdebug.mode = develop,coverage,debug" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"

ENV COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_PROCESS_TIMEOUT=1200

RUN curl --silent --show-error https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer && \
git config --global --add safe.directory "*"

RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
gpg --verify phive.phar.asc phive.phar && \
chmod +x phive.phar && \
mv phive.phar /usr/local/bin/phive \
41 changes: 21 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
forceCoversAnnotation="true"
defaultTestSuite="all"
colors="true">
<testsuites>
<testsuite name="all">
<directory>tests/</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
<directory suffix=".php">generated/</directory>
</include>
<exclude>
<file>generated/LookupTable.php</file>
</exclude>
</coverage>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
defaultTestSuite="all"
colors="true"
cacheDirectory="build/.phpunit.cache"
requireCoverageMetadata="true">
<testsuites>
<testsuite name="all">
<directory>tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src/</directory>
<directory>generated/</directory>
</include>
<exclude>
<file>generated/LookupTable.php</file>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Locator/Exception/LocatorAlreadyBuiltException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ final class LocatorAlreadyBuiltException extends LogicException implements Excep
{
public function __construct(?Throwable $previous = null)
{
parent::__construct("Locator is already built", 0, $previous);
parent::__construct("Locator is already built", previous: $previous);
}
}
2 changes: 1 addition & 1 deletion src/Locator/IndexReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
final class IndexReference implements IndexReferenceInterface
{
public function __construct(
private int $elementIndex,
private readonly int $elementIndex,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Locator/ListedReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
final class ListedReference implements ListedReferenceInterface
{
public function __construct(
private ReferenceInterface $reference,
private bool $isLast,
private readonly ReferenceInterface $reference,
private readonly bool $isLast,
) {
}

Expand Down
14 changes: 11 additions & 3 deletions src/Locator/Locator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ final class Locator implements LocatorInterface
/**
* @var list<ListedReferenceInterface>
*/
private array $listedReferences;
private readonly array $listedReferences;

public function __construct(ReferenceInterface ...$references)
{
$this->listedReferences = $this->buildListedReferences(...$references);
}


private function buildListedReferences(ReferenceInterface ...$references): array
{
$listSize = count($references);
$this->listedReferences = [];
$listedReferences = [];
foreach (array_values($references) as $index => $reference) {
$this->listedReferences[] = new ListedReference($reference, $index + 1 == $listSize);
$listedReferences[] = new ListedReference($reference, $index + 1 == $listSize);
}

return $listedReferences;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Locator/LocatorBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function create(): LocatorBuilderInterface
}

public function __construct(
private ReferenceFactoryInterface $referenceFactory,
private readonly ReferenceFactoryInterface $referenceFactory,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Locator/PropertyReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
final class PropertyReference implements ReferenceInterface
{
public function __construct(
private string $propertyName,
private readonly string $propertyName,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Parser/Exception/LL1ParserNotCreatedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ final class LL1ParserNotCreatedException extends LogicException implements Excep
{
public function __construct(?Throwable $previous = null)
{
parent::__construct("Failed to create LL(1) parser", 0, $previous);
parent::__construct("Failed to create LL(1) parser", previous: $previous);
}
}
4 changes: 2 additions & 2 deletions src/Parser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public static function create(): ParserInterface
}

public function __construct(
private Ll1ParserFactoryInterface $ll1ParserFactory,
private ReferenceFactoryInterface $referenceFactory,
private readonly Ll1ParserFactoryInterface $ll1ParserFactory,
private readonly ReferenceFactoryInterface $referenceFactory,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Parser/TranslationScheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
final class TranslationScheme implements TranslationSchemeInterface
{
public function __construct(
private LocatorBuilderInterface $locatorBuilder,
private readonly LocatorBuilderInterface $locatorBuilder,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Processor/Mutator/AppendElementMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ final class AppendElementMutation implements MutationInterface
private int $elementCounter = 0;

public function __construct(
private NodeValueInterface $value,
private PathInterface $path,
private ?int $elementIndex = null,
private readonly NodeValueInterface $value,
private readonly PathInterface $path,
private readonly ?int $elementIndex = null,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Processor/Mutator/AppendPropertyMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
final class AppendPropertyMutation implements MutationInterface
{
public function __construct(
private NodeValueInterface $value,
private PathInterface $path,
private string $propertyName,
private readonly NodeValueInterface $value,
private readonly PathInterface $path,
private readonly string $propertyName,
) {
}

Expand Down
Loading

0 comments on commit 0d40cda

Please sign in to comment.