From 6eb10526e9f5292bad1cd78d7147a2b2384dd297 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Thu, 2 Dec 2021 08:23:42 +0100 Subject: [PATCH 1/2] Test on PHP 8.1 --- .github/workflows/php.yml | 5 ++++- composer.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index b60478ab..676ea7c3 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,6 +19,7 @@ jobs: - "7.3" - "7.4" - "8.0" + - "8.1" dependencies: - "lowest" - "highest" @@ -45,9 +46,11 @@ jobs: symfony-yaml: '^6' - php: '7.4' symfony-yaml: '^6' - # symfony/yaml v3.4 is not compatible with PHP 8.0 but has no upper-bound, so it installs on it + # symfony/yaml v3.4 is not compatible with PHP 8.0+ but has no upper-bound, so it installs on it - php: '8.0' symfony-yaml: '^3.4' + - php: '8.1' + symfony-yaml: '^3.4' runs-on: ${{ matrix.os }} diff --git a/composer.json b/composer.json index 46cb26f2..6b9bae5b 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { "cebe/indent": "*", - "phpunit/phpunit": "^6.5 || ^7.5 || ^8.5 || ^9.4", + "phpunit/phpunit": "^6.5 || ^7.5 || ^8.5.14 || ^9.4", "oai/openapi-specification": "3.0.3", "mermade/openapi3-examples": "1.0.0", "apis-guru/openapi-directory": "1.0.0", From ac73b272953864f24c32d936c520665af0f5af65 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sun, 26 Dec 2021 09:37:07 +0100 Subject: [PATCH 2/2] Add ReturnTypeWillChange attributes to prevent PHP Deprecation warnings --- src/json/JsonReference.php | 1 + src/spec/Paths.php | 6 ++++++ src/spec/Responses.php | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/json/JsonReference.php b/src/json/JsonReference.php index fe27ced1..cfac559e 100644 --- a/src/json/JsonReference.php +++ b/src/json/JsonReference.php @@ -126,6 +126,7 @@ public function getReference(): string * @return mixed data which can be serialized by json_encode, * which is a value of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return (object)['$ref' => $this->getReference()]; diff --git a/src/spec/Paths.php b/src/spec/Paths.php index a2da8a10..f1ebdc2f 100644 --- a/src/spec/Paths.php +++ b/src/spec/Paths.php @@ -183,6 +183,7 @@ public function getErrors(): array * @return boolean true on success or false on failure. * The return value will be casted to boolean if non-boolean was returned. */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return $this->hasPath($offset); @@ -194,6 +195,7 @@ public function offsetExists($offset) * @param mixed $offset The offset to retrieve. * @return PathItem Can return all value types. */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->getPath($offset); @@ -205,6 +207,7 @@ public function offsetGet($offset) * @param mixed $offset The offset to assign the value to. * @param mixed $value The value to set. */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->addPath($offset, $value); @@ -215,6 +218,7 @@ public function offsetSet($offset, $value) * @link http://php.net/manual/en/arrayaccess.offsetunset.php * @param mixed $offset The offset to unset. */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { $this->removePath($offset); @@ -226,6 +230,7 @@ public function offsetUnset($offset) * @return int The custom count as an integer. * The return value is cast to an integer. */ + #[\ReturnTypeWillChange] public function count() { return count($this->_paths); @@ -236,6 +241,7 @@ public function count() * @link http://php.net/manual/en/iteratoraggregate.getiterator.php * @return Traversable An instance of an object implementing Iterator or Traversable */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->_paths); diff --git a/src/spec/Responses.php b/src/spec/Responses.php index 52476031..d2d5d855 100644 --- a/src/spec/Responses.php +++ b/src/spec/Responses.php @@ -173,6 +173,7 @@ public function getErrors(): array * @return boolean true on success or false on failure. * The return value will be casted to boolean if non-boolean was returned. */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return $this->hasResponse($offset); @@ -184,6 +185,7 @@ public function offsetExists($offset) * @param mixed $offset The offset to retrieve. * @return mixed Can return all value types. */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->getResponse($offset); @@ -195,6 +197,7 @@ public function offsetGet($offset) * @param mixed $offset The offset to assign the value to. * @param mixed $value The value to set. */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->addResponse($offset, $value); @@ -205,6 +208,7 @@ public function offsetSet($offset, $value) * @link http://php.net/manual/en/arrayaccess.offsetunset.php * @param mixed $offset The offset to unset. */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { $this->removeResponse($offset); @@ -216,6 +220,7 @@ public function offsetUnset($offset) * @return int The custom count as an integer. * The return value is cast to an integer. */ + #[\ReturnTypeWillChange] public function count() { return count($this->_responses); @@ -226,6 +231,7 @@ public function count() * @link http://php.net/manual/en/iteratoraggregate.getiterator.php * @return Traversable An instance of an object implementing Iterator or Traversable */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->_responses);