Skip to content

Commit 17d544f

Browse files
[1.0] Add PHP 8.5 support (#27)
* Add PHP 8.5 support * Update UriTemplateTest.php
1 parent 30e2865 commit 17d544f

File tree

9 files changed

+33
-35
lines changed

9 files changed

+33
-35
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ permissions:
1111
jobs:
1212
composer-normalize:
1313
name: Composer Normalize
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Composer normalize
2121
uses: docker://ergebnis/composer-normalize-action

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
build-lowest-version:
1010
name: Build lowest version
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-24.04
1212

1313
steps:
1414
- name: Set up PHP
@@ -20,7 +20,7 @@ jobs:
2020
extensions: mbstring
2121

2222
- name: Checkout code
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424

2525
- name: Install dependencies
2626
run: composer update --no-interaction --prefer-stable --prefer-lowest --no-progress
@@ -30,11 +30,11 @@ jobs:
3030

3131
build:
3232
name: Build
33-
runs-on: ubuntu-22.04
33+
runs-on: ubuntu-24.04
3434
strategy:
3535
max-parallel: 10
3636
matrix:
37-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
37+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
3838

3939
steps:
4040
- name: Set up PHP
@@ -46,7 +46,7 @@ jobs:
4646
extensions: mbstring
4747

4848
- name: Checkout code
49-
uses: actions/checkout@v4
49+
uses: actions/checkout@v5
5050

5151
- name: Install dependencies
5252
run: composer update --no-interaction --no-progress

.github/workflows/static.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ permissions:
1111
jobs:
1212
phpstan:
1313
name: PHPStan
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
23-
php-version: '7.4'
23+
php-version: '8.2'
2424
coverage: none
2525
extensions: mbstring, intl
2626

@@ -35,11 +35,11 @@ jobs:
3535

3636
php-cs-fixer:
3737
name: PHP-CS-Fixer
38-
runs-on: ubuntu-22.04
38+
runs-on: ubuntu-24.04
3939

4040
steps:
4141
- name: Checkout code
42-
uses: actions/checkout@v4
42+
uses: actions/checkout@v5
4343

4444
- name: Setup PHP
4545
uses: shivammathur/setup-php@v2
@@ -59,16 +59,16 @@ jobs:
5959

6060
psalm:
6161
name: Psalm
62-
runs-on: ubuntu-22.04
62+
runs-on: ubuntu-24.04
6363

6464
steps:
6565
- name: Checkout code
66-
uses: actions/checkout@v4
66+
uses: actions/checkout@v5
6767

6868
- name: Setup PHP
6969
uses: shivammathur/setup-php@v2
7070
with:
71-
php-version: '7.4'
71+
php-version: '8.2'
7272
coverage: none
7373
extensions: mbstring, intl
7474

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"require-dev": {
4949
"bamarni/composer-bin-plugin": "^1.8.2",
50-
"phpunit/phpunit" : "^8.5.36 || ^9.6.15",
50+
"phpunit/phpunit": "^8.5.44 || ^9.6.25",
5151
"uri-template/tests": "1.0.0"
5252
},
5353
"autoload": {

psalm-baseline.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
3-
<file src="src/UriTemplate.php">
4-
<UndefinedFunction>
5-
<code><![CDATA[\preg_last_error_msg()]]></code>
6-
</UndefinedFunction>
7-
</file>
8-
</files>
2+
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51"/>

tests/UriTemplateTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
final class UriTemplateTest extends TestCase
1414
{
15-
public function templateProvider(): array
15+
public static function templateProvider(): array
1616
{
1717
$variables = [
1818
'var' => 'value',
@@ -126,7 +126,7 @@ public function testExpandsUriTemplates(string $template, string $expansion, arr
126126
self::assertSame($expansion, UriTemplate::expand($template, $variables));
127127
}
128128

129-
public function expressionProvider(): array
129+
public static function expressionProvider(): array
130130
{
131131
return [
132132
[
@@ -167,12 +167,16 @@ public function testParsesExpressions(string $exp, array $data): void
167167
{
168168
$template = new UriTemplate();
169169

170-
// Access the config object
171170
$class = new \ReflectionClass($template);
171+
172172
$method = $class->getMethod('parseExpression');
173-
$method->setAccessible(true);
173+
174+
if (PHP_VERSION_ID < 80100) {
175+
$method->setAccessible(true);
176+
}
174177

175178
$exp = \substr($exp, 1, -1);
179+
176180
self::assertSame($data, $method->invokeArgs($template, [$exp]));
177181
}
178182

@@ -200,7 +204,7 @@ public function testAllowsNestedArrayExpansion(): void
200204
self::assertSame('http://example.com/foo/bar/one,two?query=test&more%5B0%5D=fun&more%5B1%5D=ice%20cream&baz%5Bbar%5D=fizz&baz%5Btest%5D=buzz&bam=boo', $result);
201205
}
202206

203-
public function specComplianceProvider(): \Generator
207+
public static function specComplianceProvider(): \Generator
204208
{
205209
foreach (['spec-examples.json', 'spec-examples-by-section.json', 'extended-tests.json'] as $filename) {
206210
foreach (self::parseSpecExamples($filename) as $example) {

vendor-bin/php-cs-fixer/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
3-
"php": "^7.4 || ^8.0",
4-
"friendsofphp/php-cs-fixer": "3.68.5"
3+
"php": "^7.4",
4+
"friendsofphp/php-cs-fixer": "3.86.0"
55
},
66
"config": {
77
"preferred-install": "dist"

vendor-bin/phpstan/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"require": {
3-
"php": "^7.4 || ^8.0",
4-
"phpstan/phpstan": "2.1.2",
5-
"phpstan/phpstan-deprecation-rules": "2.0.1"
3+
"php": "^8.2",
4+
"phpstan/phpstan": "2.1.22",
5+
"phpstan/phpstan-deprecation-rules": "2.0.3"
66
},
77
"config": {
88
"preferred-install": "dist"

vendor-bin/psalm/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
3-
"php": "^7.4 || ^8.0",
4-
"psalm/phar": "5.26.1"
3+
"php": "^8.2",
4+
"psalm/phar": "6.13.1"
55
},
66
"config": {
77
"preferred-install": "dist"

0 commit comments

Comments
 (0)