Skip to content

PHP warning from OpenApiDataMockerRouteMiddleware.phpL90 due to callback returning false #1

@anttikuuskoski

Description

@anttikuuskoski

The code in

if (array_key_exists($mockedStatusCode, $this->responses)) {
results in a PHP warning:

Warning: array_key_exists(): The first argument should be either a string or an integer in ybelenko\openapi-data-mocker-server-middleware\src\Mock\OpenApiDataMockerRouteMiddleware.php on line 90

The empty callback return value comes (for example) from an enabled (uncommented) but unused mock setup in https://github.com/OpenAPITools/openapi-generator/blob/349445ab0102eefb0c086a74f7be4381b1ba9c0f/modules/openapi-generator/src/main/resources/php-slim4-server/config_example.mustache#L75

So the issue might belong to the other repo as well, but as I think the callback handler should be prepared for unexpected return values, I'm placing the issue here. Please do close / move if inappropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions