Skip to content

Commit 9eb2216

Browse files
committed
Use empty array as standins for missing properties
1 parent c150ef5 commit 9eb2216

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Generator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function generate(string $namespace, string $destinationPath)
2424
{
2525
$namespace = $this->cleanUpNamespace($namespace);
2626
$codePrinter = new Standard();
27-
if (count($this->spec->components->schemas) > 0) {
27+
if (count($this->spec->components->schemas ?? []) > 0) {
2828
$schemaClassNameMap = [];
2929
foreach ($this->spec->components->schemas as $name => $schema) {
3030
$schemaClassName = $this->className($name);
@@ -51,7 +51,7 @@ public function generate(string $namespace, string $destinationPath)
5151
}
5252
}
5353

54-
if (count($this->spec->paths) > 0) {
54+
if (count($this->spec->paths ?? []) > 0) {
5555
foreach ($this->spec->paths as $path => $pathItem) {
5656
$pathClassName = $this->className($path);
5757
if (strlen($pathClassName) === 0) {

0 commit comments

Comments
 (0)