diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index ccd13c23..aa1036fa 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -14,7 +14,7 @@ jobs:
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
- php: ['7.1', '7.2', '7.3', '7.4', '8.0']
+ php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
# max 4.4.16, see https://github.com/symfony/symfony/issues/39521
# max 5.1.8, see https://github.com/symfony/symfony/issues/39521
yaml: ['5.2.9', '5.1.11', '4.4.24', '^3.4']
diff --git a/src/json/JsonReference.php b/src/json/JsonReference.php
index fe27ced1..0550cad4 100644
--- a/src/json/JsonReference.php
+++ b/src/json/JsonReference.php
@@ -8,6 +8,7 @@
namespace cebe\openapi\json;
use JsonSerializable;
+use stdClass;
/**
* Represents a JSON Reference (IETF draft-pbryan-zyp-json-ref-03)
@@ -123,10 +124,8 @@ public function getReference(): string
/**
* Specify data which should be serialized to JSON
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
- * @return mixed data which can be serialized by json_encode,
- * which is a value of any type other than a resource.
*/
- public function jsonSerialize()
+ public function jsonSerialize(): stdClass
{
return (object)['$ref' => $this->getReference()];
}
diff --git a/src/spec/Paths.php b/src/spec/Paths.php
index a2da8a10..7a04ba48 100644
--- a/src/spec/Paths.php
+++ b/src/spec/Paths.php
@@ -180,10 +180,9 @@ public function getErrors(): array
* Whether a offset exists
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
* @param mixed $offset An offset to check for.
- * @return boolean true on success or false on failure.
* The return value will be casted to boolean if non-boolean was returned.
*/
- public function offsetExists($offset)
+ public function offsetExists($offset): bool
{
return $this->hasPath($offset);
}
@@ -192,9 +191,8 @@ public function offsetExists($offset)
* Offset to retrieve
* @link http://php.net/manual/en/arrayaccess.offsetget.php
* @param mixed $offset The offset to retrieve.
- * @return PathItem Can return all value types.
*/
- public function offsetGet($offset)
+ public function offsetGet($offset): ?PathItem
{
return $this->getPath($offset);
}
@@ -205,7 +203,7 @@ public function offsetGet($offset)
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*/
- public function offsetSet($offset, $value)
+ public function offsetSet($offset, $value): void
{
$this->addPath($offset, $value);
}
@@ -215,7 +213,7 @@ public function offsetSet($offset, $value)
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
* @param mixed $offset The offset to unset.
*/
- public function offsetUnset($offset)
+ public function offsetUnset($offset): void
{
$this->removePath($offset);
}
@@ -226,7 +224,7 @@ public function offsetUnset($offset)
* @return int The custom count as an integer.
* The return value is cast to an integer.
*/
- public function count()
+ public function count(): int
{
return count($this->_paths);
}
@@ -234,9 +232,8 @@ public function count()
/**
* 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(): Traversable
{
return new ArrayIterator($this->_paths);
}
diff --git a/src/spec/Responses.php b/src/spec/Responses.php
index 52476031..e0367015 100644
--- a/src/spec/Responses.php
+++ b/src/spec/Responses.php
@@ -170,10 +170,9 @@ public function getErrors(): array
* Whether a offset exists
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
* @param mixed $offset An offset to check for.
- * @return boolean true on success or false on failure.
* The return value will be casted to boolean if non-boolean was returned.
*/
- public function offsetExists($offset)
+ public function offsetExists($offset): bool
{
return $this->hasResponse($offset);
}
@@ -182,9 +181,8 @@ public function offsetExists($offset)
* Offset to retrieve
* @link http://php.net/manual/en/arrayaccess.offsetget.php
* @param mixed $offset The offset to retrieve.
- * @return mixed Can return all value types.
*/
- public function offsetGet($offset)
+ public function offsetGet($offset): ?SpecObjectInterface
{
return $this->getResponse($offset);
}
@@ -195,7 +193,7 @@ public function offsetGet($offset)
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*/
- public function offsetSet($offset, $value)
+ public function offsetSet($offset, $value): void
{
$this->addResponse($offset, $value);
}
@@ -205,7 +203,7 @@ public function offsetSet($offset, $value)
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
* @param mixed $offset The offset to unset.
*/
- public function offsetUnset($offset)
+ public function offsetUnset($offset): void
{
$this->removeResponse($offset);
}
@@ -216,7 +214,7 @@ public function offsetUnset($offset)
* @return int The custom count as an integer.
* The return value is cast to an integer.
*/
- public function count()
+ public function count(): int
{
return count($this->_responses);
}
@@ -226,7 +224,7 @@ public function count()
* @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(): Traversable
{
return new ArrayIterator($this->_responses);
}