From b162347aff25cf4a917211f33522362283cd1c6a Mon Sep 17 00:00:00 2001 From: Jan Misker Date: Wed, 4 Aug 2021 11:12:34 +0200 Subject: [PATCH] fix when no enclosingClass can be found (#1239) In certain situations no enclosingClass can be found, quick fix is to just return then. --- src/Macro.php | 3 +++ 1 file changed, 3 insertions(+) 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) {