diff --git a/src/Macro.php b/src/Macro.php index 53421b4..77cc5a6 100644 --- a/src/Macro.php +++ b/src/Macro.php @@ -98,6 +98,9 @@ class Macro extends Method $enclosingClass = $this->method->getClosureScopeClass(); } + if (!$enclosingClass) { + return; + } /** @var \ReflectionMethod $enclosingMethod */ $enclosingMethod = Collection::make($enclosingClass->getMethods()) ->first(function (\ReflectionMethod $method) {