Skip to content

Commit

Permalink
Ignore coverage for Carbon 2 fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jan 3, 2025
1 parent cd226bc commit 7438bec
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Carbon/Types/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ protected function getMethods($boots)
if (method_exists(FactoryImmutable::class, 'getDefaultInstance')) {
// Carbon 3
return FactoryImmutable::getDefaultInstance()->getSettings()['macros'] ?? [];
} else {
// Carbon 2
$c = new ReflectionClass(Carbon::now());
$macros = $c->getProperty('globalMacros');
$macros->setAccessible(true);

return $macros->getValue();
}

// @codeCoverageIgnoreStart
// Carbon 2
$c = new ReflectionClass(Carbon::now());
$macros = $c->getProperty('globalMacros');
$macros->setAccessible(true);

return $macros->getValue();
// @codeCoverageIgnoreEnd
}

/**
Expand Down

0 comments on commit 7438bec

Please sign in to comment.