From 78cf6be56bffcb7c59866b95b1863923d1f324fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADckolas=20Daniel=20da=20Silva?= Date: Fri, 17 Jun 2022 10:55:12 +0200 Subject: [PATCH] chore(php) bump version to >= 7.4 and <= 8.1 (#9) * chore(php) bump version to >= 7.4 and <= 8.x * fix(build) adjust static analysis for PHP 8.1 * chore(deps) update libris to ^2.3.0 * chore(deps) add php ^8.1 to deps --- .github/workflows/ci.yaml | 2 +- composer.json | 4 ++-- src/Model/Container.php | 19 +++++++------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9952b17..3eae125 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: [ '7.3', '7.4', '8.0' ] + php-versions: [ '7.4', '8.0', '8.1' ] steps: - uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index 2e125b2..9890cb1 100644 --- a/composer.json +++ b/composer.json @@ -28,9 +28,9 @@ } ], "require": { - "php": ">=7.3.0", + "php": "^7.4 | ^8.0 | ^8.1", "ext-json": "*", - "researchgate/libris": "^2.1.1" + "researchgate/libris": "^2.3.0" }, "require-dev": { "phpunit/phpunit": "^9.3", diff --git a/src/Model/Container.php b/src/Model/Container.php index 34a3ffa..08964f2 100644 --- a/src/Model/Container.php +++ b/src/Model/Container.php @@ -2,6 +2,7 @@ namespace Geissler\Converter\Model; +use ReturnTypeWillChange; use Geissler\Converter\Model\Entry; /** @@ -23,14 +24,7 @@ public function __construct() $this->data = []; } - /** - * (PHP 5 >= 5.0.0)
- * Retrieve an external iterator - * @link http://php.net/manual/en/iteratoraggregate.getiterator.php - * @return \Traversable An instance of an object implementing Iterator or - * Traversable - */ - public function getIterator() + public function getIterator(): \ArrayIterator { return new \ArrayIterator($this->data); } @@ -47,7 +41,7 @@ public function getIterator() *

* The return value will be casted to boolean if non-boolean was returned. */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->data[$offset]); } @@ -61,6 +55,7 @@ public function offsetExists($offset) *

* @return mixed Can return all value types. */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->data[$offset] ?? null; @@ -80,7 +75,7 @@ public function offsetGet($offset) * @throws \ErrorException * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_object($value) == false) { throw new \ErrorException('Only objects are allowed!'); @@ -102,7 +97,7 @@ public function offsetSet($offset, $value) *

* @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->data[$offset]); } @@ -117,7 +112,7 @@ public function offsetUnset($offset) *

* The return value is cast to an integer. */ - public function count() + public function count(): int { return count($this->data); }