diff --git a/src/Processors/AugmentProperties.php b/src/Processors/AugmentProperties.php index f850cff5..3fd8d7f3 100644 --- a/src/Processors/AugmentProperties.php +++ b/src/Processors/AugmentProperties.php @@ -67,7 +67,7 @@ public function __invoke(Analysis $analysis) $property->example = $example; } - if (Generator::isDefault($property->deprecated) && ($deprecated = $this->isDeprecated((string) $context->comment))) { + if (Generator::isDefault($property->deprecated) && ($deprecated = $this->isDeprecated($context->comment))) { $property->deprecated = $deprecated; } } diff --git a/src/Processors/Concerns/DocblockTrait.php b/src/Processors/Concerns/DocblockTrait.php index c18b9f86..7c00c886 100644 --- a/src/Processors/Concerns/DocblockTrait.php +++ b/src/Processors/Concerns/DocblockTrait.php @@ -201,10 +201,10 @@ public function extractExampleDescription(?string $docblock): ?string } /** - * Returns true if the `@deprecated` tag is present, false otherwise. + * Returns true if the `\@deprecated` tag is present, false otherwise. */ public function isDeprecated(?string $docblock): bool { - return 1 === preg_match('/@deprecated\s+([ \t])?(?.+)?$/im', $docblock); + return 1 === preg_match('/@deprecated\s+([ \t])?(?.+)?$/im', (string) $docblock); } } diff --git a/tests/Fixtures/Scratch/Docblocks.php b/tests/Fixtures/Scratch/Docblocks.php index d9421e20..6d2c6312 100644 --- a/tests/Fixtures/Scratch/Docblocks.php +++ b/tests/Fixtures/Scratch/Docblocks.php @@ -17,6 +17,14 @@ class DocblockSchema * @var string The name */ public $name; + + /** + * @OA\Property + * @var string The name (old) + * + * @deprecated + */ + public $oldName; } #[OAT\Schema] diff --git a/tests/Fixtures/Scratch/Docblocks.yaml b/tests/Fixtures/Scratch/Docblocks.yaml index 14a973e8..a66ca5bc 100644 --- a/tests/Fixtures/Scratch/Docblocks.yaml +++ b/tests/Fixtures/Scratch/Docblocks.yaml @@ -16,6 +16,10 @@ components: name: description: 'The name' type: string + oldName: + description: 'The name (old)' + type: string + deprecated: true type: object DocblockSchemaChild: type: object diff --git a/tests/Fixtures/Scratch/ExclusiveMinMax31.yaml b/tests/Fixtures/Scratch/ExclusiveMinMax31.yaml index 26d04184..4c6e4392 100644 --- a/tests/Fixtures/Scratch/ExclusiveMinMax31.yaml +++ b/tests/Fixtures/Scratch/ExclusiveMinMax31.yaml @@ -3,35 +3,35 @@ info: title: 'Exclusive minimum and maximum' version: '1.0' paths: - /api/endpoint: - get: - description: 'An endpoint' - operationId: da2bbb06428a6f5ae9199a22a80436d7 - responses: - '200': - description: OK + /api/endpoint: + get: + description: 'An endpoint' + operationId: da2bbb06428a6f5ae9199a22a80436d7 + responses: + '200': + description: OK components: - schemas: - minMaxClass31: - properties: - min: - type: integer - minimum: 10 - exclusiveMin: - type: integer - exclusiveMinimum: 20 - max: - type: integer - maximum: 30 - exclusiveMax: - type: integer - exclusiveMaximum: 40 - exclusiveMinMax: - type: integer - exclusiveMinimum: 50 - exclusiveMaximum: 60 - exclusiveMinMaxNumber: - type: integer - exclusiveMinimum: 60 - exclusiveMaximum: 70 - type: object + schemas: + minMaxClass31: + properties: + min: + type: integer + minimum: 10 + exclusiveMin: + type: integer + exclusiveMinimum: 20 + max: + type: integer + maximum: 30 + exclusiveMax: + type: integer + exclusiveMaximum: 40 + exclusiveMinMax: + type: integer + exclusiveMaximum: 60 + exclusiveMinimum: 50 + exclusiveMinMaxNumber: + type: integer + exclusiveMaximum: 70 + exclusiveMinimum: 60 + type: object diff --git a/tests/Fixtures/Scratch/Nullable.yaml b/tests/Fixtures/Scratch/Nullable.yaml index b6c546ce..a1df2deb 100644 --- a/tests/Fixtures/Scratch/Nullable.yaml +++ b/tests/Fixtures/Scratch/Nullable.yaml @@ -49,6 +49,6 @@ components: type: 'null' description: type: - - string - - 'null' + - string + - 'null' type: object