Skip to content

Commit

Permalink
Adds/test compatibility with PHP 8.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebin committed Jun 13, 2023
1 parent 8a7137b commit 69ef497
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/.github export-ignore
/README.md export-ignore
/phpunit.xml export-ignore
/phpstan.neon export-ignore
/example export-ignore
/tests export-ignore
/example export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/README.md export-ignore
30 changes: 15 additions & 15 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:

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

tests_lowest_dependencies:
name: Lowest dependencies
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: git fetch --depth=100000 origin
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 7.1
php-version: '7.1'
extensions: xml
coverage: none
- run: composer update --no-progress --prefer-lowest
- run: composer phpunit

test_coverage:
name: Coverage
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: git fetch --depth=100000 origin
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 7.1
php-version: '7.1'
extensions: xml, xdebug
coverage: xdebug
- run: composer install --no-progress
Expand All @@ -59,26 +59,26 @@ jobs:
php-cs-fixer:
name: PHP CS Fixer
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: '8.2'
extensions: xml
coverage: none
- run: composer install --no-progress
- run: composer php-cs-fixer-dry-run

phpstan:
name: PHPStan
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: '8.2'
coverage: none
- run: composer install --no-progress
- run: composer phpstan
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor/
/.idea/
/.*.cache
/tests-report-html/
/composer.lock
Expand Down
15 changes: 14 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@
'@PSR12:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'php_unit_test_class_requires_covers' => false,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'backtick_to_shell_exec' => true,
'blank_line_before_statement' => [
'statements' => ['declare', 'return', 'case'],
],
'comment_to_phpdoc' => false,
'declare_equal_normalize' => ['space' => 'single'],
'global_namespace_import' => true,
'linebreak_after_opening_tag' => true,
'native_function_invocation' => false,
'no_unset_on_property' => false,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_to_comment' => false,
'self_static_accessor' => true,
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![CI](https://img.shields.io/github/workflow/status/ddebin/atom-generator/CI?style=for-the-badge)
![CI](https://img.shields.io/github/actions/workflow/status/ddebin/atom-generator/main.yaml?style=for-the-badge)
[![Codecov](https://img.shields.io/codecov/c/github/ddebin/atom-generator?logo=codecov&style=for-the-badge)](https://codecov.io/gh/ddebin/atom-generator)
![PHP from Packagist](https://img.shields.io/packagist/php-v/ddebin/atom-generator?logo=php&style=for-the-badge)
[![Packagist Version](https://img.shields.io/packagist/v/ddebin/atom-generator?style=for-the-badge)](https://packagist.org/packages/ddebin/atom-generator)
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
}
},
"scripts": {
"coverage": "phpunit --coverage-clover=clover.xml",
"php-cs-fixer": "php-cs-fixer fix --allow-risky=yes",
"php-cs-fixer-dry-run": "php-cs-fixer fix --dry-run --allow-risky=yes",
"phpstan": "phpstan analyse -l max -c phpstan.neon src tests",
"phpunit": "phpunit",
"coverage": "@php phpunit --coverage-clover=clover.xml",
"php-cs-fixer": "@php php-cs-fixer fix --allow-risky=yes",
"php-cs-fixer-dry-run": "@php php-cs-fixer fix --dry-run --allow-risky=yes",
"phpstan": "@php phpstan analyse -l max -c phpstan.neon src tests example .php-cs-fixer.php",
"phpunit": "@php phpunit",
"test": [
"@php-cs-fixer-dry-run",
"@phpstan",
Expand Down
2 changes: 2 additions & 0 deletions example/feed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

include_once 'vendor/autoload.php';

$entry = new AtomGenerator\Entry();
Expand Down
2 changes: 2 additions & 0 deletions src/AbstractElement.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace AtomGenerator;

use DateTime;
Expand Down
2 changes: 2 additions & 0 deletions src/Entry.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace AtomGenerator;

use DateTimeInterface;
Expand Down
4 changes: 3 additions & 1 deletion src/Feed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace AtomGenerator;

use DOMDocument;
Expand Down Expand Up @@ -228,7 +230,7 @@ public function saveXML()
*
* @see https://cweiske.de/tagebuch/atom-validation.htm
*
* @param null|libXMLError[] $errors
* @param null|LibXMLError[] $errors
*/
public static function validate(DOMDocument $document, ?array &$errors = null): bool
{
Expand Down
4 changes: 3 additions & 1 deletion tests/FeedTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

namespace Tests;

use AtomGenerator\Entry;
Expand Down Expand Up @@ -234,7 +236,7 @@ public function testFeedCreationException4(): void
}

/**
* @param libXMLError[] $errors
* @param LibXMLError[] $errors
*
* @codeCoverageIgnore
*/
Expand Down

0 comments on commit 69ef497

Please sign in to comment.