mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Fix access to api->components in RouteMetadataDescriber (#1635)
* Fix access to api->components in RouteMetadataDescriber * cs
This commit is contained in:
parent
82d766bfe4
commit
4027fe8b6c
@ -73,7 +73,7 @@ final class RouteMetadataDescriber implements RouteDescriberInterface
|
||||
private function getRefParams(OA\OpenApi $api, OA\Operation $operation): array
|
||||
{
|
||||
/** @var OA\Parameter[] $globalParams */
|
||||
$globalParams = OA\UNDEFINED !== $api->components->parameters ? $api->components->parameters : [];
|
||||
$globalParams = OA\UNDEFINED !== $api->components && OA\UNDEFINED !== $api->components->parameters ? $api->components->parameters : [];
|
||||
$existingParams = [];
|
||||
|
||||
$operationParameters = OA\UNDEFINED !== $operation->parameters ? $operation->parameters : [];
|
||||
|
27
Tests/RouteDescriber/RouteMetadataDescriberTest.php
Normal file
27
Tests/RouteDescriber/RouteMetadataDescriberTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle package.
|
||||
*
|
||||
* (c) Nelmio
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Tests\RouteDescriber;
|
||||
|
||||
use Nelmio\ApiDocBundle\RouteDescriber\RouteMetadataDescriber;
|
||||
use OpenApi\Annotations\OpenApi;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
class RouteMetadataDescriberTest extends TestCase
|
||||
{
|
||||
public function testUndefinedCheck()
|
||||
{
|
||||
$routeDescriber = new RouteMetadataDescriber();
|
||||
|
||||
$this->assertNull($routeDescriber->describe(new OpenApi([]), new Route('foo'), new \ReflectionMethod(__CLASS__, 'testUndefinedCheck')));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user