Skip to content

Commit 69ef497

Browse files
committed
Adds/test compatibility with PHP 8.2.
1 parent 8a7137b commit 69ef497

11 files changed

Lines changed: 52 additions & 28 deletions

File tree

.gitattributes

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
/.gitignore export-ignore
44
/.php-cs-fixer.php export-ignore
55
/.github export-ignore
6-
/README.md export-ignore
7-
/phpunit.xml export-ignore
8-
/phpstan.neon export-ignore
6+
/example export-ignore
97
/tests export-ignore
10-
/example export-ignore
8+
/phpstan.neon export-ignore
9+
/phpunit.xml export-ignore
10+
/README.md export-ignore

.github/workflows/main.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ on:
66

77
jobs:
88
tests:
9-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-22.04
1010
strategy:
1111
matrix:
12-
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
12+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
1313
name: PHP ${{ matrix.php }}
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616
# required for "git tag" presence for MonorepoBuilder split and ChangelogLinker git tags resolver; default is 1
1717
- run: git fetch --depth=100000 origin
1818
# see https://github.com/shivammathur/setup-php
@@ -26,29 +26,29 @@ jobs:
2626

2727
tests_lowest_dependencies:
2828
name: Lowest dependencies
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-22.04
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v3
3232
- run: git fetch --depth=100000 origin
3333
# see https://github.com/shivammathur/setup-php
3434
- uses: shivammathur/setup-php@v2
3535
with:
36-
php-version: 7.1
36+
php-version: '7.1'
3737
extensions: xml
3838
coverage: none
3939
- run: composer update --no-progress --prefer-lowest
4040
- run: composer phpunit
4141

4242
test_coverage:
4343
name: Coverage
44-
runs-on: ubuntu-latest
44+
runs-on: ubuntu-22.04
4545
steps:
46-
- uses: actions/checkout@v2
46+
- uses: actions/checkout@v3
4747
- run: git fetch --depth=100000 origin
4848
# see https://github.com/shivammathur/setup-php
4949
- uses: shivammathur/setup-php@v2
5050
with:
51-
php-version: 7.1
51+
php-version: '7.1'
5252
extensions: xml, xdebug
5353
coverage: xdebug
5454
- run: composer install --no-progress
@@ -59,26 +59,26 @@ jobs:
5959
6060
php-cs-fixer:
6161
name: PHP CS Fixer
62-
runs-on: ubuntu-latest
62+
runs-on: ubuntu-22.04
6363
steps:
64-
- uses: actions/checkout@v2
64+
- uses: actions/checkout@v3
6565
# see https://github.com/shivammathur/setup-php
6666
- uses: shivammathur/setup-php@v2
6767
with:
68-
php-version: 7.4
68+
php-version: '8.2'
6969
extensions: xml
7070
coverage: none
7171
- run: composer install --no-progress
7272
- run: composer php-cs-fixer-dry-run
7373

7474
phpstan:
7575
name: PHPStan
76-
runs-on: ubuntu-latest
76+
runs-on: ubuntu-22.04
7777
steps:
78-
- uses: actions/checkout@v2
78+
- uses: actions/checkout@v3
7979
- uses: shivammathur/setup-php@v2
8080
with:
81-
php-version: 8.1
81+
php-version: '8.2'
8282
coverage: none
8383
- run: composer install --no-progress
8484
- run: composer phpstan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
2+
/.idea/
23
/.*.cache
34
/tests-report-html/
45
/composer.lock

.php-cs-fixer.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,23 @@
1111
'@PSR12:risky' => true,
1212
'@PhpCsFixer' => true,
1313
'@PhpCsFixer:risky' => true,
14+
'@PHP71Migration' => true,
15+
'@PHP71Migration:risky' => true,
1416
'array_syntax' => ['syntax' => 'short'],
1517
'php_unit_test_class_requires_covers' => false,
16-
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
18+
'backtick_to_shell_exec' => true,
19+
'blank_line_before_statement' => [
20+
'statements' => ['declare', 'return', 'case'],
21+
],
22+
'comment_to_phpdoc' => false,
23+
'declare_equal_normalize' => ['space' => 'single'],
24+
'global_namespace_import' => true,
25+
'linebreak_after_opening_tag' => true,
1726
'native_function_invocation' => false,
27+
'no_unset_on_property' => false,
28+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
29+
'phpdoc_to_comment' => false,
30+
'self_static_accessor' => true,
1831
])
1932
->setFinder($finder)
2033
;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![CI](https://img.shields.io/github/workflow/status/ddebin/atom-generator/CI?style=for-the-badge)
1+
![CI](https://img.shields.io/github/actions/workflow/status/ddebin/atom-generator/main.yaml?style=for-the-badge)
22
[![Codecov](https://img.shields.io/codecov/c/github/ddebin/atom-generator?logo=codecov&style=for-the-badge)](https://codecov.io/gh/ddebin/atom-generator)
33
![PHP from Packagist](https://img.shields.io/packagist/php-v/ddebin/atom-generator?logo=php&style=for-the-badge)
44
[![Packagist Version](https://img.shields.io/packagist/v/ddebin/atom-generator?style=for-the-badge)](https://packagist.org/packages/ddebin/atom-generator)

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
}
4646
},
4747
"scripts": {
48-
"coverage": "phpunit --coverage-clover=clover.xml",
49-
"php-cs-fixer": "php-cs-fixer fix --allow-risky=yes",
50-
"php-cs-fixer-dry-run": "php-cs-fixer fix --dry-run --allow-risky=yes",
51-
"phpstan": "phpstan analyse -l max -c phpstan.neon src tests",
52-
"phpunit": "phpunit",
48+
"coverage": "@php phpunit --coverage-clover=clover.xml",
49+
"php-cs-fixer": "@php php-cs-fixer fix --allow-risky=yes",
50+
"php-cs-fixer-dry-run": "@php php-cs-fixer fix --dry-run --allow-risky=yes",
51+
"phpstan": "@php phpstan analyse -l max -c phpstan.neon src tests example .php-cs-fixer.php",
52+
"phpunit": "@php phpunit",
5353
"test": [
5454
"@php-cs-fixer-dry-run",
5555
"@phpstan",

example/feed.php

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

3+
declare(strict_types = 1);
4+
35
include_once 'vendor/autoload.php';
46

57
$entry = new AtomGenerator\Entry();

src/AbstractElement.php

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

3+
declare(strict_types = 1);
4+
35
namespace AtomGenerator;
46

57
use DateTime;

src/Entry.php

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

3+
declare(strict_types = 1);
4+
35
namespace AtomGenerator;
46

57
use DateTimeInterface;

src/Feed.php

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

3+
declare(strict_types = 1);
4+
35
namespace AtomGenerator;
46

57
use DOMDocument;
@@ -228,7 +230,7 @@ public function saveXML()
228230
*
229231
* @see https://cweiske.de/tagebuch/atom-validation.htm
230232
*
231-
* @param null|libXMLError[] $errors
233+
* @param null|LibXMLError[] $errors
232234
*/
233235
public static function validate(DOMDocument $document, ?array &$errors = null): bool
234236
{

0 commit comments

Comments
 (0)