Skip to content

Commit

Permalink
fix: dont use method invocation directly
Browse files Browse the repository at this point in the history
  • Loading branch information
canvural committed Jun 4, 2022
1 parent 2404fa8 commit 2a0b2da
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Methods/Pipes/Macros.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace NunoMaduro\Larastan\Methods\Pipes;

use function array_key_exists;
use Carbon\Traits\Macro as CarbonMacro;
use Closure;
use Illuminate\Database\Eloquent\Builder;
Expand Down Expand Up @@ -73,9 +74,7 @@ public function handle(PassableContract $passable, Closure $next): void
$refProperty = $classReflection->getNativeReflection()->getProperty($macroTraitProperty);
$refProperty->setAccessible(true);

$found = $className === Builder::class
? $className::hasGlobalMacro($passable->getMethodName())
: $className::hasMacro($passable->getMethodName());
$found = array_key_exists($passable->getMethodName(), $refProperty->getValue());

if ($found) {
$reflectionFunction = new \ReflectionFunction($refProperty->getValue()[$passable->getMethodName()]);
Expand Down

0 comments on commit 2a0b2da

Please sign in to comment.