From e931f83e9de5e8f46b346bce2a951b5263d1aaca Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Mon, 2 Dec 2024 12:02:15 +1300 Subject: [PATCH] Add Yaml flags type-hint and other minor tweaks --- phpstan-baseline.neon | 10 ---------- src/Annotations/AbstractAnnotation.php | 2 ++ src/Processors/Concerns/DocblockTrait.php | 2 -- tests/ContextTest.php | 3 +-- tests/PipelineTest.php | 2 -- tools/src/Docs/RefGenerator.php | 2 -- 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 8252520aa..1dc46f075 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -50,16 +50,6 @@ parameters: count: 1 path: src/Annotations/Schema.php - - - message: "#^Result of && is always false\\.$#" - count: 3 - path: src/Processors/AugmentProperties.php - - - - message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-string and '' will always evaluate to false\\.$#" - count: 1 - path: src/Processors/AugmentProperties.php - - message: "#^Call to function is_array\\(\\) with bool\\|OpenApi\\\\Annotations\\\\AdditionalProperties will always evaluate to false\\.$#" count: 1 diff --git a/src/Annotations/AbstractAnnotation.php b/src/Annotations/AbstractAnnotation.php index 227bc21e6..bd3cc9948 100644 --- a/src/Annotations/AbstractAnnotation.php +++ b/src/Annotations/AbstractAnnotation.php @@ -251,6 +251,8 @@ public function mergeProperties($object): void /** * Generate the documentation in YAML format. + * + * @param int-mask-of|null $flags A bit field of PARSE_* constants to customize the YAML parser behavior */ public function toYaml(?int $flags = null): string { diff --git a/src/Processors/Concerns/DocblockTrait.php b/src/Processors/Concerns/DocblockTrait.php index dd0b32cbd..dd6590b6b 100644 --- a/src/Processors/Concerns/DocblockTrait.php +++ b/src/Processors/Concerns/DocblockTrait.php @@ -186,8 +186,6 @@ public function extractVarTypeAndDescription(?string $docblock): array ); } - // ------------------------------------------------------------------------ - /** * Extract example text from a `@example` dockblock line. */ diff --git a/tests/ContextTest.php b/tests/ContextTest.php index adfcac6b3..2fd363244 100644 --- a/tests/ContextTest.php +++ b/tests/ContextTest.php @@ -54,12 +54,11 @@ public function testDebugLocation(): void { $this->assertOpenApiLogEntryContains('Required @OA\PathItem() not found'); $openapi = (new Generator($this->getTrackingLogger())) - ->setAnalyser(new TokenAnalyser()) ->generate([$this->fixture('Customer.php')]); $customerSchema = $openapi->components->schemas[0]; $this->assertStringContainsString( - 'Fixtures/Customer.php on line 16', + 'Fixtures/Customer.php on line ', $customerSchema->_context->getDebugLocation() ); diff --git a/tests/PipelineTest.php b/tests/PipelineTest.php index a0f1b9dda..4cc01a5ac 100644 --- a/tests/PipelineTest.php +++ b/tests/PipelineTest.php @@ -25,8 +25,6 @@ public function __construct(string $add) $this->add = $add; } - // ------------------------------------------------------------------------ - public function __invoke($payload) { return $payload . $this->add; diff --git a/tools/src/Docs/RefGenerator.php b/tools/src/Docs/RefGenerator.php index 4f1006b8f..847f6d971 100644 --- a/tools/src/Docs/RefGenerator.php +++ b/tools/src/Docs/RefGenerator.php @@ -159,8 +159,6 @@ public function formatAnnotationsDetails(string $name, string $fqdn, string $fil return ob_get_clean(); } - // ------------------------------------------------------------------------ - protected function getPropertyDocumentation(string $fqdn, string $name): array { /** @var class-string $class */