Skip to content

Commit

Permalink
Clean up static analyser issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed May 20, 2022
1 parent 7c7dc26 commit fb94ab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 10 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ parameters:
count: 1
path: src/Annotations/Schema.php

-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: src/Context.php

-
message: "#^Ternary operator condition is always true\\.$#"
count: 1
Expand Down Expand Up @@ -70,6 +65,16 @@ parameters:
count: 1
path: src/Processors/AugmentSchemas.php

-
message: "#^Parameter \\#1 \\$annotation of method OpenApi\\\\Processors\\\\DocBlockDescriptions\\:\\:description\\(\\) expects OpenApi\\\\Annotations\\\\Operation\\|OpenApi\\\\Annotations\\\\Parameter\\|OpenApi\\\\Annotations\\\\Schema, OpenApi\\\\Annotations\\\\AbstractAnnotation given\\.$#"
count: 1
path: src/Processors/DocBlockDescriptions.php

-
message: "#^Parameter \\#1 \\$annotation of method OpenApi\\\\Processors\\\\DocBlockDescriptions\\:\\:summaryAndDescription\\(\\) expects OpenApi\\\\Annotations\\\\Operation\\|OpenApi\\\\Annotations\\\\Parameter\\|OpenApi\\\\Annotations\\\\Schema, OpenApi\\\\Annotations\\\\AbstractAnnotation given\\.$#"
count: 1
path: src/Processors/DocBlockDescriptions.php

-
message: "#^Property OpenApi\\\\Annotations\\\\JsonContent\\:\\:\\$examples \\(array\\<string, OpenApi\\\\Annotations\\\\Examples\\>\\) does not accept string\\.$#"
count: 1
Expand Down Expand Up @@ -99,4 +104,3 @@ parameters:
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
count: 1
path: tests/Annotations/AttributesSyncTest.php

8 changes: 2 additions & 6 deletions src/Processors/DocblockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,11 @@ public function extractDescription(?string $docblock): string
return Generator::UNDEFINED;
}

$description = '';
if (false !== ($substr = substr($this->extractContent($docblock), strlen($summary)))) {
$description = trim($substr);
} else {
$description = '';
}
if ($description === '') {
return Generator::UNDEFINED;
}

return $description;
return $description ?: Generator::UNDEFINED;
}
}

0 comments on commit fb94ab5

Please sign in to comment.