From c37af64ffd1160db42630a0c9864dd221c38dc1c Mon Sep 17 00:00:00 2001 From: Michael Diodone Date: Thu, 12 Oct 2023 14:27:46 +0200 Subject: [PATCH 1/4] Add PHP 8.2 compatibility --- .github/workflows/ci.yaml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3eae125..e957512 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: [ '7.4', '8.0', '8.1' ] + php-versions: [ '7.4', '8.0', '8.1', '8.2' ] steps: - uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index 9890cb1..243c4eb 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ } ], "require": { - "php": "^7.4 | ^8.0 | ^8.1", + "php": "^7.4 | ^8.0 | ^8.1 | ^8.2", "ext-json": "*", "researchgate/libris": "^2.3.0" }, From fe62b2d3c74f66415f28ba7183a895311440fffc Mon Sep 17 00:00:00 2001 From: Michael Diodone Date: Thu, 12 Oct 2023 14:35:21 +0200 Subject: [PATCH 2/4] Update packages to latest version To avoid deprecation notices in PHP 8.2 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 243c4eb..61cc928 100644 --- a/composer.json +++ b/composer.json @@ -35,8 +35,8 @@ "require-dev": { "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.9", - "phpstan/phpstan": "^0.12.42", + "vimeo/psalm": "^5.15.0", + "phpstan/phpstan": "^1.10.38", "friendsofphp/php-cs-fixer": "^3.1" }, "autoload": { From f1deb8379e4a04f0d388db655a6b45e499d3d748 Mon Sep 17 00:00:00 2001 From: Michael Diodone Date: Thu, 12 Oct 2023 14:53:57 +0200 Subject: [PATCH 3/4] Fix psalm issues --- src/Model/Container.php | 4 +++- src/Model/Entry.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Model/Container.php b/src/Model/Container.php index 08964f2..8a61ff3 100644 --- a/src/Model/Container.php +++ b/src/Model/Container.php @@ -3,13 +3,15 @@ namespace Geissler\Converter\Model; use ReturnTypeWillChange; -use Geissler\Converter\Model\Entry; /** * Abstract container to access groups of objects as "array"-object. * * @author Benjamin Geißler * @license MIT + * + * @template-implements \IteratorAggregate + * @template-implements \ArrayAccess */ abstract class Container implements \IteratorAggregate, \ArrayAccess, \Countable { diff --git a/src/Model/Entry.php b/src/Model/Entry.php index ea540f7..5d31796 100644 --- a/src/Model/Entry.php +++ b/src/Model/Entry.php @@ -950,7 +950,7 @@ public function getInterviewer() * @param $issue * @return Entry */ - public function setIssue($issue) + public function setIssue(string $issue) { $this->issue = $issue; return $this; @@ -1582,7 +1582,7 @@ public function getSubmitted() * @param $title * @return Entry */ - public function setTitle($title) + public function setTitle(string $title) { $this->title = $title; return $this; @@ -1690,7 +1690,7 @@ public function getVersion() * @param $volume * @return Entry */ - public function setVolume($volume) + public function setVolume(string $volume) { $this->volume = $volume; return $this; From 491ab18fff8a559c30d86d024545b0347ee308e3 Mon Sep 17 00:00:00 2001 From: Michael Diodone Date: Thu, 12 Oct 2023 14:54:41 +0200 Subject: [PATCH 4/4] Only run ci workflow on pushes to or PRs against main Otherwise, it runs twice for a PR. --- .github/workflows/ci.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e957512..1fb7c42 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,10 @@ name: ci -on: [ push, pull_request ] +on: + push: + branches: [main] + pull_request: + branches: [main] jobs: build-test: