Skip to content

Commit

Permalink
Merge pull request #32 from almightynassar/patch-1
Browse files Browse the repository at this point in the history
Handles Opis\Closure\SerializableClosure error
  • Loading branch information
tomirons authored May 12, 2021
2 parents c408925 + f209007 commit 0adb58b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Commands/ExportPostmanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Console\Command;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Routing\RouteAction;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
Expand Down Expand Up @@ -140,6 +141,11 @@ public function handle(): void

protected function getReflectionMethod(array $routeAction): ?object
{
// Hydrates the closure if it is an instance of Opis\Closure\SerializableClosure
if (RouteAction::containsSerializedClosure($routeAction)) {
$routeAction['uses'] = unserialize($routeAction['uses'])->getClosure();
}

if ($routeAction['uses'] instanceof Closure) {
return new ReflectionFunction($routeAction['uses']);
}
Expand Down

0 comments on commit 0adb58b

Please sign in to comment.