Skip to content

Commit

Permalink
fix(openapi): method OpenApi::getComponents must always return a Comp…
Browse files Browse the repository at this point in the history
…onents object (#6158)
  • Loading branch information
vincentchalamon authored Feb 12, 2024
1 parent 86be7df commit a987469
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/OpenApi/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ final class OpenApi
public const VERSION = '3.1.0';

private string $openapi = self::VERSION;
private Components $components;

public function __construct(private Info $info, private array $servers, private Paths $paths, private ?Components $components = null, private array $security = [], private array $tags = [], private $externalDocs = null, private ?string $jsonSchemaDialect = null, private readonly ?\ArrayObject $webhooks = null)
public function __construct(private Info $info, private array $servers, private Paths $paths, ?Components $components = null, private array $security = [], private array $tags = [], private $externalDocs = null, private ?string $jsonSchemaDialect = null, private readonly ?\ArrayObject $webhooks = null)
{
$this->components = $components ?? new Components();
}

public function getOpenapi(): string
Expand Down

0 comments on commit a987469

Please sign in to comment.