diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index aff943a02..fb019c023 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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 @@ -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\\\\) does not accept string\\.$#" count: 1 @@ -99,4 +104,3 @@ parameters: message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#" count: 1 path: tests/Annotations/AttributesSyncTest.php - diff --git a/src/Processors/DocblockTrait.php b/src/Processors/DocblockTrait.php index 45fe8971a..8dc85041e 100644 --- a/src/Processors/DocblockTrait.php +++ b/src/Processors/DocblockTrait.php @@ -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; } }