Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PHP 8.4 for XML v3 #82

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/analyzers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
composer-options: ['--ignore-platform-req=php+']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/autoloader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
composer-options: ['--ignore-platform-req=php+']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/code-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
composer-options: ['--ignore-platform-req=php+']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
steps:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/stress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
composer-options: ['--ignore-platform-req=php+']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
steps:
Expand All @@ -21,6 +22,6 @@ jobs:
tools: 'composer:v2'
extensions: pcov, mbstring, posix, dom, libxml, xml, xsl, xmlreader, xmlwriter
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
- name: Run the stress tests
run: composer run stress
7 changes: 4 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2', '8.3']
experimental: [false]
php-versions: ['8.2', '8.3', '8.4']
composer-options: ['--ignore-platform-req=php+']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
steps:
Expand All @@ -27,8 +27,9 @@ jobs:
ini-values: error_reporting=E_ALL
extensions: pcov, mbstring, posix, dom, libxml, xml, xsl, xmlreader, xmlwriter
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
- name: Run the tests
run: composer run tests
- name: Check tests quality
run: composer run testquality
continue-on-error: ${{ matrix.php-versions == '8.4' }} # Infection is not ready yet.
6 changes: 3 additions & 3 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^9.5.10" installed="9.6.13" location="./tools/phpunit.phar" copy="true"/>
<phar name="infection" version="^0.26" installed="0.26.21" location="./tools/infection.phar" copy="true"/>
<phar name="php-cs-fixer" version="^3.3.2" installed="3.39.0" location="./tools/php-cs-fixer.phar" copy="true"/>
<phar name="phpunit" version="^9.5.10" installed="9.6.21" location="./tools/phpunit.phar" copy="true"/>
<phar name="infection" version="^0.27" installed="0.27.11" location="./tools/infection.phar" copy="true"/>
<phar name="php-cs-fixer" version="^3.3.2" installed="3.64.0" location="./tools/php-cs-fixer.phar" copy="true"/>
</phive>
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'nullable_type_declaration_for_default_null_value' => true,
])
;
2 changes: 1 addition & 1 deletion build/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env php
<?php
<?php declare(strict_types=1);

use Psl\File\WriteMode;
use Symfony\Component\Finder\Finder;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"type": "library",
"require": {
"php": "~8.2.0 || ~8.3.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-dom": "*",
"ext-libxml": "*",
"ext-xml": "*",
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Dom/Xpath.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function locate(callable $locator)
* @throws RuntimeException
* @return NodeList<DOMNode>
*/
public function query(string $expression, DOMNode $contextNode = null): NodeList
public function query(string $expression, ?DOMNode $contextNode = null): NodeList
{
return $this->locate(query($expression, $contextNode));
}
Expand All @@ -73,7 +73,7 @@ public function query(string $expression, DOMNode $contextNode = null): NodeList
* @throws RuntimeException
* @throws InvalidArgumentException
*/
public function querySingle(string $expression, DOMNode $contextNode = null): DOMNode
public function querySingle(string $expression, ?DOMNode $contextNode = null): DOMNode
{
return $this->locate(query_single($expression, $contextNode));
}
Expand All @@ -86,7 +86,7 @@ public function querySingle(string $expression, DOMNode $contextNode = null): DO
* @return T
* @throws RuntimeException
*/
public function evaluate(string $expression, TypeInterface $type, DOMNode $contextNode = null)
public function evaluate(string $expression, TypeInterface $type, ?DOMNode $contextNode = null)
{
return $this->locate(evaluate($expression, $type, $contextNode));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Dom/Xpath/Locator/evaluate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @return Closure(DOMXPath): T
*/
function evaluate(string $query, TypeInterface $type, DOMNode $node = null): Closure
function evaluate(string $query, TypeInterface $type, ?DOMNode $node = null): Closure
{
return
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Dom/Xpath/Locator/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* @return Closure(DOMXPath): NodeList<DOMNode>
*/
function query(string $query, DOMNode $node = null): Closure
function query(string $query, ?DOMNode $node = null): Closure
{
return static function (DOMXPath $xpath) use ($query, $node): NodeList {
$node = $node ?? $xpath->document->documentElement;
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Dom/Xpath/Locator/query_single.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @return Closure(DOMXPath): DOMNode
*/
function query_single(string $query, DOMNode $node = null): Closure
function query_single(string $query, ?DOMNode $node = null): Closure
{
return
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Encoding/Exception/EncodingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class EncodingException extends Exception implements ExceptionInterface
{
private function __construct(string $message, Exception $previous = null)
private function __construct(string $message, ?Exception $previous = null)
{
parent::__construct(
$message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ function grouped_children(DOMElement $element): array
return reduce_with_keys(
group_child_elements($element),
/**
* @param array $children
* @param DOMElement|list<DOMElement> $child
* @return array
*/
static fn (array $children, string $name, DOMElement|array $child): array
=> merge(
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class RuntimeException extends \RuntimeException implements ExceptionInterface
{
private function __construct(string $message, Throwable $previous = null)
private function __construct(string $message, ?Throwable $previous = null)
{
parent::__construct(
$message,
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Reader/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function provide(callable $matcher, ?Signal $signal = null): Generator

yield from stop_on_first_issue(
static function () use ($reader, $signal): bool {
if($signal->stopRequested()) {
if ($signal->stopRequested()) {
return !$reader->close();
}

Expand Down
2 changes: 1 addition & 1 deletion tools/full-coverage-check.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env php
<?php
<?php declare(strict_types=1);

require_once dirname(__DIR__).'/vendor/autoload.php';

Expand Down
Binary file modified tools/infection.phar
Binary file not shown.
Binary file modified tools/php-cs-fixer.phar
Binary file not shown.
Loading
Loading