SwaggerAssertions icon indicating copy to clipboard operation
SwaggerAssertions copied to clipboard

Incompatible with PHP 8.1 due to "justinrainbow/json-schema"

Open MasonM opened this issue 2 years ago • 0 comments

Running this under PHP 8.1 will give deprecation warnings, since 8.1 is now enforcing return type compatibility for internal classes (source):

[03-Nov-2023 20:09:50 UTC] PHP Fatal error:  During inheritance of Iterator: Uncaught Behat\Testwork\Call\Exception\CallErrorException: 8192: Return type of JsonSchema\Iterator\ObjectIterator::current() should either be compatible with Iterator::current(): mixed, or the
 #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.php line 42 in /app/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php:90
Stack trace:
#0 /app/vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.php(17): Behat\Testwork\Call\Handler\RuntimeCallHandler->handleError(8192, 'Return type of ...', '/app/ven...', 42)
#1 /app/vendor/composer/ClassLoader.php(571): include('/app/ven...')
#2 /app/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/app/ven...')
#3 /app/vendor/fr3d/swagger-assertions/src/JsonSchema/RefResolver.php(86): Composer\Autoload\ClassLoader->loadClass('JsonSchema\\Iter...')                                                                                                                             #4 /app/vendor/fr3d/swagger-assertions/src/JsonSchema/RefResolver.php(70): FR3D\SwaggerAssertions\JsonSchema\RefResolver->resolveSchemas(Object(stdClass), 'https://adobest...', Array)
#5 /app/vendor/fr3d/swagger-assertions/src/JsonSchema/RefResolver.php(54): FR3D\SwaggerAssertions\JsonSchema\RefResolver->resolveCached('https://adobest...', Array)
#6 /app/include/app/Swagger.php(110): FR3D\SwaggerAssertions\JsonSchema\RefResolver->resolve('https://adobest...')
#7 /app/tests/behat/context/ApiContext.php(858): app\Swagger::getSchemaManager()

There's a PR to fix this: https://github.com/justinrainbow/json-schema/pull/682

MasonM avatar Nov 03 '23 20:11 MasonM