Skip to content

Commit 850595c

Browse files
authored
Merge pull request #23 from pottink/php8.1
PHP8.1 and Symfony 6 compatibility
2 parents d6e08cc + f3e330c commit 850595c

15 files changed

Lines changed: 86546 additions & 84475 deletions

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/.github export-ignore
2-
tests/ export-ignore
2+
tests/ export-ignore
33
tools/ export-ignore
44
tools/* binary
55
/.gitattributes export-ignore

.github/workflows/grumphp.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
operating-system: [ubuntu-latest]
10-
php-versions: ['7.4', '8.0']
10+
php-versions: ['8.0', '8.1']
1111
composer-options: ['', '--prefer-lowest']
1212
fail-fast: false
1313
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} with ${{ matrix.composer-options }}
@@ -34,14 +34,7 @@ jobs:
3434
path: ${{ steps.composercache.outputs.dir }}
3535
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3636
restore-keys: ${{ runner.os }}-composer-
37-
- name: Install dependencies <PHP8
38-
if: matrix.php-versions != '8.0'
39-
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
40-
#
41-
# Currently php-cs-fixer is nog PHP 8 compatible yet!
42-
#
43-
- name: Install dependencies PHP8
44-
if: matrix.php-versions == '8.0'
37+
- name: Install dependencies
4538
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} --ignore-platform-reqs
4639
- name: Set git variables
4740
run: |
@@ -50,4 +43,4 @@ jobs:
5043
- name: Run the tests
5144
run: php vendor/bin/grumphp run --no-interaction
5245
env:
53-
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.php-versions == '8.0'}}
46+
PHP_CS_FIXER_IGNORE_ENV: 1

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/vendor/
22
composer.lock
3-
.php_cs.cache
3+
.php-cs-fixer.cache
44
.phpunit.result.cache
55
/coverage/
66
infection.log

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
return PhpCsFixer\Config::create()
3+
return (new PhpCsFixer\Config())
44
->setFinder(
5-
\Symfony\Component\Finder\Finder::create()
6-
->name('*.php')
5+
PhpCsFixer\Finder::create()
76
->in([
87
__DIR__ . '/examples',
98
__DIR__ . '/src',
109
__DIR__ . '/tests',
1110
])
11+
->name('*.php')
1212
)
1313
->setRiskyAllowed(true)
1414
->setRules([
@@ -17,7 +17,7 @@
1717
'array_indentation' => true,
1818
'array_syntax' => ['syntax' => 'short'],
1919
'backtick_to_shell_exec' => true,
20-
'blank_line_before_return' => true,
20+
'blank_line_before_statement' => ['statements' => ['return']],
2121
'class_keyword_remove' => false,
2222
'combine_consecutive_issets' => true,
2323
'combine_consecutive_unsets' => true,
@@ -49,7 +49,7 @@
4949
'no_blank_lines_before_namespace' => false,
5050
'no_null_property_initialization' => true,
5151
'no_php4_constructor' => true,
52-
'no_short_echo_tag' => false,
52+
'echo_tag_syntax' => ['format'=> 'long'],
5353
'no_superfluous_elseif' => true,
5454
'no_unreachable_default_argument_value' => true,
5555
'no_useless_else' => true,
@@ -63,7 +63,7 @@
6363
'php_unit_mock' => false,
6464
'php_unit_namespaced' => false,
6565
'php_unit_no_expectation_annotation' => false,
66-
'php_unit_ordered_covers' => true,
66+
'phpdoc_order_by_value' => ['annotations' => ['covers']],
6767
'php_unit_set_up_tear_down_visibility' => true,
6868
'php_unit_strict' => false,
6969
'php_unit_test_annotation' => false,
@@ -73,7 +73,7 @@
7373
'phpdoc_order' => true,
7474
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
7575
'pow_to_exponentiation' => true,
76-
'psr0' => true,
76+
'psr_autoloading' => ['dir' => 'src'],
7777
'random_api_migration' => false,
7878
'simplified_null_return' => true,
7979
'static_lambda' => false,

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.4 || ^8.0",
14+
"php": "^8.0",
1515
"ext-json": "*",
1616
"amphp/amp": "^2.5",
17-
"azjezz/psl": "^1.6",
17+
"azjezz/psl": "~1.9.1",
1818
"league/uri": "^6.3",
1919
"php-http/client-common": "^2.3",
2020
"php-http/discovery": "^1.12",
@@ -34,9 +34,9 @@
3434
"php-http/mock-client": "^1.4",
3535
"php-http/vcr-plugin": "^1.0",
3636
"phpro/grumphp-shim": "^1.2",
37-
"symfony/http-client": "^5.1",
38-
"symfony/property-access": "^5.2",
39-
"symfony/serializer": "^5.2"
37+
"symfony/http-client": "^5.3 || ^6.0",
38+
"symfony/property-access": "^5.3 || ^6.0",
39+
"symfony/serializer": "^5.3 || ^6.0"
4040
},
4141
"suggest": {
4242
"symfony/http-client": "If you want to use the built-in symfony/http-client tools.",

grumphp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
grumphp:
22
tasks:
33
phpcsfixer2:
4-
config: ".php_cs.dist"
4+
config: ".php-cs-fixer.dist.php"
55
config_contains_finder: true
66
psalm:
77
config: psalm.xml

phive.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="psalm" version="4.3.1" installed="4.3.1" location="./tools/psalm.phar" copy="true"/>
4-
<phar name="phpunit" version="^9.3.9" installed="9.3.9" location="./tools/phpunit.phar" copy="true"/>
5-
<phar name="php-cs-fixer" version="^2.17.0" installed="2.17.1" location="./tools/php-cs-fixer.phar" copy="true"/>
3+
<phar name="psalm" version="4.13.1" installed="4.13.1" location="./tools/psalm.phar" copy="true"/>
4+
<phar name="phpunit" version="^9.5" installed="9.5.10" location="./tools/phpunit.phar" copy="true"/>
5+
<phar name="php-cs-fixer" version="^3.3" installed="3.3.2" location="./tools/php-cs-fixer.phar" copy="true"/>
66
</phive>

psalm.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
>
99
<projectFiles>
1010
<directory name="src" />
11-
<directory name="examples" />
1211
<directory name="static-analysis" />
1312
<ignoreFiles>
1413
<directory name="tests" />

src/Request/Request.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
final class Request implements RequestInterface
1414
{
1515
/**
16-
* @var 'POST'|'GET'|'PUT'|'PATCH'|'DELETE'
16+
* @var 'DELETE'|'GET'|'PATCH'|'POST'|'PUT'
1717
*/
1818
private string $method;
1919
private string $uri;
@@ -25,7 +25,7 @@ final class Request implements RequestInterface
2525
private $body;
2626

2727
/**
28-
* @param 'POST'|'GET'|'PUT'|'PATCH'|'DELETE' $method
28+
* @param 'DELETE'|'GET'|'PATCH'|'POST'|'PUT' $method
2929
* @param RequestType $body
3030
*/
3131
public function __construct(string $method, string $uri, array $uriParameters, $body)
@@ -37,7 +37,7 @@ public function __construct(string $method, string $uri, array $uriParameters, $
3737
}
3838

3939
/**
40-
* @return 'POST'|'GET'|'PUT'|'PATCH'|'DELETE'
40+
* @return 'DELETE'|'GET'|'PATCH'|'POST'|'PUT'
4141
*/
4242
public function method(): string
4343
{

src/Request/RequestInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
interface RequestInterface
1212
{
1313
/**
14-
* @return 'POST'|'GET'|'PUT'|'PATCH'|'DELETE'
14+
* @return 'DELETE'|'GET'|'PATCH'|'POST'|'PUT'
1515
*/
1616
public function method(): string;
1717

0 commit comments

Comments
 (0)