瀏覽代碼

fix for php < 7.1.0

Michael Wallner 6 年之前
父節點
當前提交
15ae0b4d61
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/Tools/Generator.php

+ 4 - 1
src/Tools/Generator.php

@@ -84,7 +84,10 @@ class Generator
                 continue;
             }
 
-            $formRequestClass = new ReflectionClass($paramType->getName());
+            $formRequestClassName = version_compare(phpversion(), '7.1.0', '<')
+                ? $paramType->__toString()
+                : $paramType->getName();
+            $formRequestClass = new ReflectionClass($formRequestClassName);
             if ($formRequestClass->isSubclassOf(\Illuminate\Foundation\Http\FormRequest::class)) {
                 $formRequestDocBlock = new DocBlock($formRequestClass->getDocComment());
                 $bodyParametersFromDocBlock = $this->getBodyParametersFromDocBlock($formRequestDocBlock->getTags());