Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from kylekatarnls/patch-1
Browse files Browse the repository at this point in the history
Fix compatibility with Carbon >= 1.26
  • Loading branch information
KristofMorva authored Jan 24, 2019
2 parents 424453b + 29e44b3 commit 0e4e0f9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Console/MacrosCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class MacrosCommand extends Command
'\Illuminate\Database\Schema\Blueprint',
'\Illuminate\Support\Arr',
'\Illuminate\Support\Carbon',
'\Carbon\Carbon',
'\Carbon\CarbonImmutable',
'\Carbon\CarbonInterval',
'\Carbon\CarbonPeriod',
'\Illuminate\Support\Collection',
'\Illuminate\Console\Scheduling\Event',
'\Illuminate\Database\Eloquent\FactoryBuilder',
Expand Down Expand Up @@ -66,11 +70,15 @@ public function handle()
}

$reflection = new \ReflectionClass($class);
if (!$reflection->hasProperty('macros')) {
continue;
$propertyName = 'macros';
if (!$reflection->hasProperty($propertyName)) {
$propertyName = 'globalMacros';
if (!$reflection->hasProperty($propertyName)) {
continue;
}
}

$property = $reflection->getProperty('macros');
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$macros = $property->getValue();

Expand Down

0 comments on commit 0e4e0f9

Please sign in to comment.