From aca333643d64fd939df53c14d40bd5cfe64ac4da Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Mon, 8 Jan 2024 10:50:05 +1300 Subject: [PATCH 1/2] CS --- Examples/using-traits/BellsAndWhistles.php | 2 +- Examples/using-traits/Product.php | 2 +- tests/Fixtures/Parser/AllTraits.php | 2 +- tests/Fixtures/Parser/User.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Examples/using-traits/BellsAndWhistles.php b/Examples/using-traits/BellsAndWhistles.php index 13ed1e672..25870e85f 100644 --- a/Examples/using-traits/BellsAndWhistles.php +++ b/Examples/using-traits/BellsAndWhistles.php @@ -11,7 +11,7 @@ trait BellsAndWhistles { use Bells; - use \OpenApi\Examples\UsingTraits\Decoration\Whistles; + use Decoration\Whistles; /** * The plating. diff --git a/Examples/using-traits/Product.php b/Examples/using-traits/Product.php index 2d2d22727..2966db319 100644 --- a/Examples/using-traits/Product.php +++ b/Examples/using-traits/Product.php @@ -9,7 +9,7 @@ */ class Product { - use \OpenApi\Examples\UsingTraits\Colour; + use Colour; use BellsAndWhistles; /** diff --git a/tests/Fixtures/Parser/AllTraits.php b/tests/Fixtures/Parser/AllTraits.php index d2d5e89ec..550a48a2d 100644 --- a/tests/Fixtures/Parser/AllTraits.php +++ b/tests/Fixtures/Parser/AllTraits.php @@ -9,5 +9,5 @@ trait AllTraits { use AsTrait; - use \OpenApi\Tests\Fixtures\Parser\HelloTrait; + use HelloTrait; } diff --git a/tests/Fixtures/Parser/User.php b/tests/Fixtures/Parser/User.php index e8b170b23..f35c6a6bb 100644 --- a/tests/Fixtures/Parser/User.php +++ b/tests/Fixtures/Parser/User.php @@ -14,7 +14,7 @@ * example=User::CONSTANT, * ) */ -class User extends ParentClass implements \OpenApi\Tests\Fixtures\Parser\UserInterface +class User extends ParentClass implements UserInterface { use Hello; From 13dd466eb2527a5c2990c6a6172d69875aa8e07a Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Mon, 8 Jan 2024 10:50:34 +1300 Subject: [PATCH 2/2] Clarify enum handling for phpstan --- src/Processors/ExpandEnums.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Processors/ExpandEnums.php b/src/Processors/ExpandEnums.php index 90876a801..cbae7a0f2 100644 --- a/src/Processors/ExpandEnums.php +++ b/src/Processors/ExpandEnums.php @@ -41,8 +41,11 @@ protected function expandContextEnum(Analysis $analysis): void $schemaType = $schema->type; $enumType = null; - if ($re->isBacked() && ($backingType = $re->getBackingType()) && $backingType instanceof \ReflectionNamedType) { - $enumType = $backingType->getName(); + if ($re->isBacked()) { + $backingType = $re->getBackingType(); + if ($backingType instanceof \ReflectionNamedType) { + $enumType = $backingType->getName(); + } } // no (or invalid) schema type means name