diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c165d56..211e2a2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] + php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] steps: ## checkout the repoistory @@ -27,7 +27,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached, mysql, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, sqlite - ini-values: date.timezone='UTC' + ini-values: date.timezone='UTC',error_reporting=E_ALL,display_errors=On ## install composer - name: Install dependencies @@ -36,7 +36,7 @@ jobs: ## run unit tests - name: PHP Unit tests for PHP run: vendor/bin/phpunit --verbose --configuration actions.phpunit.xml - if: matrix.php == '8.0' || matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2' || matrix.php == '7.0' + if: matrix.php == '8.1' || matrix.php == '8.0' || matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2' || matrix.php == '7.0' ## unit test with coverage - name: PHP Unit tests for PHP 7.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0009f1d..bdcc391 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 2.9.1 (25. May 2022) + ++ [#38](https://github.com/luyadev/luya-headless/pull/38) PHP 8.1 compatibility + ## 2.9.0 (22. September 2021) + [#35](https://github.com/luyadev/luya-headless/pull/35) Added strict caching property which is by default enabled. Strict cache will only cache data which are from status 200 response code. diff --git a/src/base/AbstractRequestClient.php b/src/base/AbstractRequestClient.php index e595008..58b1a3d 100644 --- a/src/base/AbstractRequestClient.php +++ b/src/base/AbstractRequestClient.php @@ -210,7 +210,7 @@ public function setEndpoint($endpoint) */ public function getRequestUrl() { - $parts = [rtrim($this->client->serverUrl, '/'), $this->client->language, ltrim($this->endpoint, '/')]; + $parts = [rtrim($this->client->serverUrl, '/'), $this->client->language, ltrim((string) $this->endpoint, '/')]; $url = implode("/", array_filter($parts)); diff --git a/src/base/BaseIterator.php b/src/base/BaseIterator.php index dcf1c75..f14079a 100644 --- a/src/base/BaseIterator.php +++ b/src/base/BaseIterator.php @@ -120,6 +120,7 @@ public function addItem(array $item, $key) * {@inheritDoc} * @see Countable::count() */ + #[\ReturnTypeWillChange] public function count() { return count($this->data); @@ -131,6 +132,7 @@ public function count() * {@inheritDoc} * @see Iterator::rewind() */ + #[\ReturnTypeWillChange] public function rewind() { return reset($this->data); @@ -140,11 +142,16 @@ public function rewind() * {@inheritDoc} * @see Iterator::current() */ + #[\ReturnTypeWillChange] public function current() { return current($this->data); } + /** + * {@inheritDoc} + */ + #[\ReturnTypeWillChange] public function key() { return key($this->data); @@ -154,6 +161,7 @@ public function key() * {@inheritDoc} * @see Iterator::next() */ + #[\ReturnTypeWillChange] public function next() { return next($this->data); @@ -163,6 +171,7 @@ public function next() * {@inheritDoc} * @see Iterator::valid() */ + #[\ReturnTypeWillChange] public function valid() { return key($this->data) !== null; @@ -174,6 +183,7 @@ public function valid() * {@inheritDoc} * @see ArrayAccess::offsetSet() */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->data[$offset] = $value; @@ -183,6 +193,7 @@ public function offsetSet($offset, $value) * {@inheritDoc} * @see ArrayAccess::offsetExists() */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->data[$offset]); @@ -192,6 +203,7 @@ public function offsetExists($offset) * {@inheritDoc} * @see ArrayAccess::offsetUnset() */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->data[$offset]); @@ -201,6 +213,7 @@ public function offsetUnset($offset) * {@inheritDoc} * @see ArrayAccess::offsetGet() */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return isset($this->data[$offset]) ? $this->data[$offset] : null;