shalvah 3 years ago
parent
commit
e39ce83fd7
3 changed files with 30 additions and 23 deletions
  1. 16 11
      CHANGELOG.md
  2. 13 11
      camel/Extraction/ExtractedEndpointData.php
  3. 1 1
      src/Tools/Globals.php

+ 16 - 11
CHANGELOG.md

@@ -12,45 +12,50 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 
 
 ### Removed
 ### Removed
 
 
+## 3.33.2 (9 July 2022)
+### Fixed
+- Infer URL parameter name correctly when an interface is used for binding ([#494](https://github.com/knuckleswtf/scribe/pull/494))
+
+
 ## 3.33.1 (8 July 2022)
 ## 3.33.1 (8 July 2022)
 ### Fixed
 ### Fixed
-- Don't send empty query parameter field if it's optional ([#493](https://github.com/knuckleswtf/scribe/commit/493)))
-- Infer URL parameter name correctly when `getRouteKeyName()` is set ([#492](https://github.com/knuckleswtf/scribe/commit/492)))
+- Don't send empty query parameter field if it's optional ([#493](https://github.com/knuckleswtf/scribe/commit/493))
+- Infer URL parameter name correctly when `getRouteKeyName()` is set ([#492](https://github.com/knuckleswtf/scribe/pull/492))
 
 
 
 
 ## 3.33.0 (27 June 2022)
 ## 3.33.0 (27 June 2022)
 ### Added
 ### Added
-- Include description in Postman collection for formdata body parameters ([10faa500](https://github.com/knuckleswtf/scribe/commit/10faa500e36e02d4efcecf8ad5e1d91ba1c7728d)))
-- Support for attributes in `@apiResource` ([8b8bc6b0](https://github.com/knuckleswtf/scribe/commit/8b8bc6b04242ea5d35916db84e2a7cbe73e0cef5)))
+- Include description in Postman collection for formdata body parameters ([10faa500](https://github.com/knuckleswtf/scribe/commit/10faa500e36e02d4efcecf8ad5e1d91ba1c7728d))
+- Support for attributes in `@apiResource` ([8b8bc6b0](https://github.com/knuckleswtf/scribe/commit/8b8bc6b04242ea5d35916db84e2a7cbe73e0cef5))
 
 
 
 
 ## 3.32.0 (23 June 2022)
 ## 3.32.0 (23 June 2022)
 ### Modified
 ### Modified
-- Improved code blocks hiding ([#486](https://github.com/knuckleswtf/scribe/pull/486)))
+- Improved code blocks hiding ([#486](https://github.com/knuckleswtf/scribe/pull/486))
 
 
 
 
 ## 3.31.0 (16 June 2022)
 ## 3.31.0 (16 June 2022)
 ### Modified
 ### Modified
-- Postman collection: replace multipart PUT/PATCH requests with POST & `_method` ([#480](https://github.com/knuckleswtf/scribe/pull/480)))
+- Postman collection: replace multipart PUT/PATCH requests with POST & `_method` ([#480](https://github.com/knuckleswtf/scribe/pull/480))
 
 
 ### Fixed
 ### Fixed
-- Fix logo image partially covered by sidebar ([#481](https://github.com/knuckleswtf/scribe/pull/481)))
+- Fix logo image partially covered by sidebar ([#481](https://github.com/knuckleswtf/scribe/pull/481))
 
 
 
 
 ## 3.30.0 (11 June 2022)
 ## 3.30.0 (11 June 2022)
 ### Added
 ### Added
-- Support for more inline validator forms (`$request->validate(...)` without assignment, and `$this->validate($request, ...)`) ([29940c2e](https://github.com/knuckleswtf/scribe/commit/29940c2e05c8035a1ab85d9482c2335e1747ab41)))
+- Support for more inline validator forms (`$request->validate(...)` without assignment, and `$this->validate($request, ...)`) ([29940c2e](https://github.com/knuckleswtf/scribe/commit/29940c2e05c8035a1ab85d9482c2335e1747ab41))
 
 
 ### Fixed
 ### Fixed
-- Fix incorrect public_path check on Lumen ([64ad2f6e](https://github.com/knuckleswtf/scribe/commit/64ad2f6e059bea03e9ba5b209818e916758ca36a)))
+- Fix incorrect public_path check on Lumen ([64ad2f6e](https://github.com/knuckleswtf/scribe/commit/64ad2f6e059bea03e9ba5b209818e916758ca36a))
 
 
 ## 3.29.1 (22 May 2022)
 ## 3.29.1 (22 May 2022)
 ### Fixed
 ### Fixed
-- Make output path for `laravel` type configurable ([48b2b90](https://github.com/knuckleswtf/scribe/commit/48b2b90580f92dbe2fa5ebdad207fa082c875532)))
+- Make output path for `laravel` type configurable ([48b2b90](https://github.com/knuckleswtf/scribe/commit/48b2b90580f92dbe2fa5ebdad207fa082c875532))
 
 
 ## 3.29.0 (22 May 2022)
 ## 3.29.0 (22 May 2022)
 ### Added
 ### Added
-- 🎉🎉 Support multiple docs with the `--config` flag ([#472](https://github.com/knuckleswtf/scribe/pull/472), [cc6c95e](https://github.com/knuckleswtf/scribe/commit/cc6c95eed2a999a640666eab8b7dad1b417c9aca)))
+- 🎉🎉 Support multiple docs with the `--config` flag ([#472](https://github.com/knuckleswtf/scribe/pull/472), [cc6c95e](https://github.com/knuckleswtf/scribe/commit/cc6c95eed2a999a640666eab8b7dad1b417c9aca))
 
 
 ## 3.28.0 (14 May 2022)
 ## 3.28.0 (14 May 2022)
 ### Added
 ### Added

+ 13 - 11
camel/Extraction/ExtractedEndpointData.php

@@ -212,20 +212,22 @@ class ExtractedEndpointData extends BaseDTO
 
 
     protected static function instantiateTypedArgument(\ReflectionNamedType $argumentType): ?object
     protected static function instantiateTypedArgument(\ReflectionNamedType $argumentType): ?object
     {
     {
-        $argumentInstance = null;
         $argumentClassName = $argumentType->getName();
         $argumentClassName = $argumentType->getName();
 
 
         if (class_exists($argumentClassName)) {
         if (class_exists($argumentClassName)) {
-            $argumentInstance = new $argumentClassName;
-        } else if (interface_exists($argumentClassName)) {
-            $argumentInstance = app($argumentClassName);
+            return new $argumentClassName;
         }
         }
 
 
-        return $argumentInstance;
+        if (interface_exists($argumentClassName)) {
+            return app($argumentClassName);
+        }
+
+        return null;
     }
     }
 
 
-    public static function getFieldBindingForUrlParam(Route  $route, string $paramName, array $typeHintedArguments = [],
-                                                      string $default = null): ?string
+    public static function getFieldBindingForUrlParam(
+        Route $route, string $paramName, array $typeHintedArguments = [], string $default = null
+    ): ?string
     {
     {
         $binding = null;
         $binding = null;
         // Was added in Laravel 7.x
         // Was added in Laravel 7.x
@@ -268,11 +270,11 @@ class ExtractedEndpointData extends BaseDTO
     {
     {
         $argumentType = $argument->getType();
         $argumentType = $argument->getType();
         if (!($argumentType instanceof \ReflectionNamedType)) {
         if (!($argumentType instanceof \ReflectionNamedType)) {
-            // The argument does not have a type-hint
+            // The argument does not have a type-hint, or is a primitive type (`string`, ..)
             return false;
             return false;
-        } else {
-            $argumentInstance = self::instantiateTypedArgument($argumentType);
-            return ($argumentInstance instanceof Model);
         }
         }
+
+        $argumentInstance = self::instantiateTypedArgument($argumentType);
+        return ($argumentInstance instanceof Model);
     }
     }
 }
 }

+ 1 - 1
src/Tools/Globals.php

@@ -4,7 +4,7 @@ namespace Knuckles\Scribe\Tools;
 
 
 class Globals
 class Globals
 {
 {
-    public const SCRIBE_VERSION = '3.33.1';
+    public const SCRIBE_VERSION = '3.33.2';
 
 
     public static bool $shouldBeVerbose = false;
     public static bool $shouldBeVerbose = false;