Skip to content

Commit 0adb58b

Browse files
authored
Merge pull request #32 from almightynassar/patch-1
Handles Opis\Closure\SerializableClosure error
2 parents c408925 + f209007 commit 0adb58b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Commands/ExportPostmanCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Console\Command;
77
use Illuminate\Contracts\Config\Repository;
88
use Illuminate\Foundation\Http\FormRequest;
9+
use Illuminate\Routing\RouteAction;
910
use Illuminate\Routing\Router;
1011
use Illuminate\Support\Facades\Storage;
1112
use Illuminate\Support\Str;
@@ -140,6 +141,11 @@ public function handle(): void
140141

141142
protected function getReflectionMethod(array $routeAction): ?object
142143
{
144+
// Hydrates the closure if it is an instance of Opis\Closure\SerializableClosure
145+
if (RouteAction::containsSerializedClosure($routeAction)) {
146+
$routeAction['uses'] = unserialize($routeAction['uses'])->getClosure();
147+
}
148+
143149
if ($routeAction['uses'] instanceof Closure) {
144150
return new ReflectionFunction($routeAction['uses']);
145151
}

0 commit comments

Comments
 (0)