diff --git a/.idea/php.xml b/.idea/php.xml index 631724e..f085a6d 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -32,166 +32,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -236,6 +76,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json index cd14edf..3356f3b 100644 --- a/composer.json +++ b/composer.json @@ -52,17 +52,17 @@ "fakerphp/faker": "^1.9", "firebase/php-jwt": "^6.0.0", "guzzlehttp/promises": "^1.4.0", - "illuminate/collections": "^8.0", + "illuminate/collections": "^10.0", + "league/openapi-psr7-validator": "^0.18", "monolog/monolog": "^1.25.1 || ^2.8.0 || ^3.0.0", "myclabs/deep-copy": "^1.11", "nesbot/carbon": "^2.48", "nyholm/psr7": "1.*", - "league/openapi-psr7-validator": "^0.18", "openclassrooms/openapi-psr7-validator": "dev-master", "opis/json-schema": "^2.3", "php-http/httplug": "^2.2", "phpdocumentor/reflection-docblock": "^5.3", - "phpstan/phpdoc-parser": "^1.2", + "phpstan/phpdoc-parser": "^2.3", "phpunit/phpunit": "^9.5", "psr/http-client": "^1.0", "psr/http-message": "1.*", @@ -100,10 +100,6 @@ "veewee/composer-run-parallel": "^1.1" }, "repositories": [ - { - "type": "vcs", - "url": "https://github.com/sidux/collections" - }, { "type": "vcs", "url": "https://github.com/OpenClassrooms/openapi-psr7-validator" diff --git a/src/Definition/Loader/OpenApiDefinitionLoader.php b/src/Definition/Loader/OpenApiDefinitionLoader.php index 8aff352..525368a 100644 --- a/src/Definition/Loader/OpenApiDefinitionLoader.php +++ b/src/Definition/Loader/OpenApiDefinitionLoader.php @@ -43,6 +43,7 @@ use cebe\openapi\spec\RequestBody; use cebe\openapi\spec\Schema; use cebe\openapi\spec\SecurityRequirement; +use cebe\openapi\spec\SecurityRequirements; use cebe\openapi\spec\SecurityScheme; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -117,7 +118,7 @@ private function getOperations(array $paths, array $securitySchemes, array $filt /** @var RequestBody $requestBody */ $requestBody = $operation->requestBody; $responses = $operation->responses; - $requirements = $this->getSecurityRequirementsScopes($operation->security ?? []); + $requirements = $this->getSecurityRequirementsScopes($operation->security ?? new SecurityRequirements([])); $operations->add( Operation::create( @@ -174,14 +175,12 @@ private function getTags(array $tags): Tags } /** - * @param SecurityRequirement[] $securityRequirements - * * @return array */ - private function getSecurityRequirementsScopes(array $securityRequirements): array + private function getSecurityRequirementsScopes(SecurityRequirements $securityRequirements): array { $requirements = []; - foreach ($securityRequirements as $requirement) { + foreach ($securityRequirements->getRequirements() as $requirement) { /** * @var string $name * @var string[] $data