NelmioApiDocBundle/Util/SetsContextTrait.php
Alexey Alshenetsky 14383f4ee5
Add support for zircore/swagger-php 4.0 (#1916)
* add zircore/swagger-php v4 to composer.json

* fix incompatibilities

* add compatibility with 3.2

* Apply fixes from StyleCI

* mark SetsContextTrait as internal

* Bump php version

Co-authored-by: Alexey <alshenestky@icloud.com>
Co-authored-by: Alexey Alshenetsky <alshenetsky@users.noreply.github.com>
Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2021-12-11 14:39:04 +01:00

23 lines
450 B
PHP

<?php
namespace Nelmio\ApiDocBundle\Util;
use OpenApi\Context;
/**
* @internal
*/
trait SetsContextTrait
{
private function setContext(?Context $context): void
{
if (class_exists(\OpenApi\Analyser::class)) {
// zircote/swagger-php ^3.2
\OpenApi\Analyser::$context = $context;
} else {
/// zircote/swagger-php ^4.0
\OpenApi\Generator::$context = $context;
}
}
}