Skip to content

Commit

Permalink
swagger-php 4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Zrnik committed Apr 19, 2024
1 parent 45b6700 commit 606a590
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
61 changes: 30 additions & 31 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/PHPUnit/OpenApiSchemaCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use JsonSerializable;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Schema;
use OpenApi\Context;
use OpenApi\Generator;
use PHPUnit\Framework\ExpectationFailedException;
use ReflectionClass;
Expand Down Expand Up @@ -167,6 +168,7 @@ private function assertIsNotSchemaObject(object $noSchemaObject, ?string $messag

public function assertIsSchemaObject(object $schemaObject, ?string $message = null): void
{
Generator::$context ??= new Context();
$schemaAttributes = AttributeReflection::getClassAttributes(Schema::class, $schemaObject);
$this->addToAssertionCount(1);

Expand All @@ -186,6 +188,7 @@ public function assertIsSchemaObject(object $schemaObject, ?string $message = nu

public function getPropertyAttribute(object $schemaObject, ReflectionProperty $reflectionProperty): Property
{
Generator::$context ??= new Context();
$propertyAttributes = AttributeReflection::getPropertyAttributes(
Property::class,
$schemaObject,
Expand All @@ -201,6 +204,7 @@ public function getPropertyAttribute(object $schemaObject, ReflectionProperty $r

private function isSchemaProperty(object $schemaObject, ReflectionProperty $reflectionProperty): bool
{
Generator::$context ??= new Context();
$propertyAttributes = AttributeReflection::getPropertyAttributes(
Property::class,
$schemaObject,
Expand All @@ -212,6 +216,7 @@ private function isSchemaProperty(object $schemaObject, ReflectionProperty $refl

private function isSchemaClass(object $schemaObject): bool
{
Generator::$context ??= new Context();
$classAttributes = AttributeReflection::getClassAttributes(
Schema::class,
$schemaObject,
Expand Down
1 change: 1 addition & 0 deletions src/ZweistOpenApiGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function __construct(
parent::__construct($logger);
$this->setVersion(OpenApi::VERSION_3_0_0);
$this->addProcessor($this);
Generator::$context ??= new Context();
}

// @phpstan-ignore-next-line
Expand Down

0 comments on commit 606a590

Please sign in to comment.