Skip to content

Test on PHP 8.1 #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "lowest"
- "highest"
Expand All @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/json/JsonReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function getReference(): string
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return (object)['$ref' => $this->getReference()];
Expand Down
6 changes: 6 additions & 0 deletions src/spec/Paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that this library is not compatible with PHP 5, as far as I see it would be better to make return types compatible instead of adding the annotation which only hides the deprecation warning but does not actually fix the problem.

see https://php.watch/versions/8.1/internal-method-return-types

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just seen that this is what #143 does, will check that in more detail later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intended this as a middle step in order to keep BC.

After this there's #143 to be merged

public function offsetExists($offset)
{
return $this->hasPath($offset);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -236,6 +241,7 @@ public function count()
* @link http://php.net/manual/en/iteratoraggregate.getiterator.php
* @return Traversable An instance of an object implementing <b>Iterator</b> or <b>Traversable</b>
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->_paths);
Expand Down
6 changes: 6 additions & 0 deletions src/spec/Responses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -226,6 +231,7 @@ public function count()
* @link http://php.net/manual/en/iteratoraggregate.getiterator.php
* @return Traversable An instance of an object implementing <b>Iterator</b> or <b>Traversable</b>
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->_responses);
Expand Down