Skip to content

Commit a987469

Browse files
fix(openapi): method OpenApi::getComponents must always return a Components object (#6158)
1 parent 86be7df commit a987469

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/OpenApi/OpenApi.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ final class OpenApi
2525
public const VERSION = '3.1.0';
2626

2727
private string $openapi = self::VERSION;
28+
private Components $components;
2829

29-
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)
30+
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)
3031
{
32+
$this->components = $components ?? new Components();
3133
}
3234

3335
public function getOpenapi(): string

0 commit comments

Comments
 (0)