diff --git a/composer.json b/composer.json index c6b3d33..db95e8f 100644 --- a/composer.json +++ b/composer.json @@ -17,16 +17,16 @@ "php": "^8.4.0", "atto/codegen-tools": "^0.1.2", "psr/http-message": "^2.0", - "psr/log": "^3.0", - "symfony/console": "^7.4 || ^8.4", - "membrane/openapi-reader": "^3.1", - "membrane/openapi-router": "0.5.2" + "psr/log": "^3.0.2", + "symfony/console": "^7.4.11 || ^8.0.11", + "membrane/openapi-reader": "^3.1.1", + "membrane/openapi-router": "0.5.3" }, "require-dev": { - "phpunit/phpunit": "^13.0.5", - "phpstan/phpstan": "^2.1.40", - "squizlabs/php_codesniffer": "^3.13.5", - "guzzlehttp/psr7": "^2.9.0", + "phpunit/phpunit": "^13.1.11", + "phpstan/phpstan": "^2.1.55", + "squizlabs/php_codesniffer": "^4.0.1", + "guzzlehttp/psr7": "^2.10.1", "mikey179/vfsstream": "^1.6.12" }, "bin": [ diff --git a/src/Filter/String/Implode.php b/src/Filter/String/Implode.php index 9dc2d04..c10d352 100644 --- a/src/Filter/String/Implode.php +++ b/src/Filter/String/Implode.php @@ -23,16 +23,25 @@ public function __construct( public function filter(mixed $value): Result { if (!is_array($value)) { - return Result::invalid( - $value, - new MessageSet( - null, - new Message('Implode Filter expects an array value, %s passed instead', [gettype($value)]) - ) - ); + return Result::invalid($value, new MessageSet(null, new Message( + 'Implode Filter expects an array value, %s passed instead', + [gettype($value)], + ))); } - return Result::noResult(implode($this->delimiter, $value)); + $strings = []; + foreach ($value as $v) { + if (!is_string($v)) { + return Result::invalid($value, new MessageSet(null, new Message( + 'Implode Filter expects strings, %s passed instead', + [gettype($v)], + ))); + } + $strings[] = $v; + } + + + return Result::noResult(implode($this->delimiter, $strings)); } public function __toString(): string diff --git a/src/OpenAPI/Builder/OpenAPIRequestBuilder.php b/src/OpenAPI/Builder/OpenAPIRequestBuilder.php index 15a17f2..41cba9a 100644 --- a/src/OpenAPI/Builder/OpenAPIRequestBuilder.php +++ b/src/OpenAPI/Builder/OpenAPIRequestBuilder.php @@ -93,7 +93,11 @@ private function fromParameters(OpenAPIRequest $specification): array } $fieldSets = []; - foreach ($locations as $in => ['required' => $required, 'fields' => $fields, 'beforeSet' => $beforeSet]) { + foreach ($locations as $in => $location) { + $fields = $location['fields']; + $required = $location['required'] ?? []; + $beforeSet = $location['beforeSet'] ?? []; + if (!empty($required)) { $beforeSet[] = new RequiredFields(...$required); }