Explorar el Código

Fix call to undefined method forceRootUrl in lumen

Calls to undefined methods are a subclass of `\Error` in PHP 7
Jan-Hendrik Frintrop hace 6 años
padre
commit
e5809b84a7
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      src/Postman/CollectionWriter.php

+ 6 - 1
src/Postman/CollectionWriter.php

@@ -25,7 +25,12 @@ class CollectionWriter
 
     public function getCollection()
     {
-        URL::forceRootUrl(config('app.url'));
+        try {
+            URL::forceRootUrl(config('app.url'));
+        } catch (\Error $e) {
+            echo "Warning: Couldn't force base url as Lumen currently doesn't have the forceRootUrl method.\n";
+            echo "You should probably double check URLs in your generated documentation.\n";
+        }
 
         $collection = [
             'variables' => [],