diff --git a/src/Carbon/CarbonPeriod.php b/src/Carbon/CarbonPeriod.php index 0e81e7573a..04a4cf56ca 100644 --- a/src/Carbon/CarbonPeriod.php +++ b/src/Carbon/CarbonPeriod.php @@ -377,7 +377,7 @@ public static function instance($period) ); } - $class = \get_called_class(); + $class = static::class; $type = \gettype($period); throw new NotAPeriodException( diff --git a/src/Carbon/Traits/Serialization.php b/src/Carbon/Traits/Serialization.php index eebc69bd0c..ee287bef15 100644 --- a/src/Carbon/Traits/Serialization.php +++ b/src/Carbon/Traits/Serialization.php @@ -142,7 +142,7 @@ public function __sleep() #[ReturnTypeWillChange] public function __wakeup() { - if (get_parent_class() && method_exists(parent::class, '__wakeup')) { + if (parent::class && method_exists(parent::class, '__wakeup')) { // @codeCoverageIgnoreStart try { parent::__wakeup(); diff --git a/tests/CarbonPeriod/MacroTest.php b/tests/CarbonPeriod/MacroTest.php index 32c9b5c826..784a041bbf 100644 --- a/tests/CarbonPeriod/MacroTest.php +++ b/tests/CarbonPeriod/MacroTest.php @@ -24,7 +24,7 @@ class MacroTest extends AbstractTestCase { protected function tearDown(): void { - $reflection = new ReflectionClass('Carbon\CarbonPeriod'); + $reflection = new ReflectionClass(CarbonPeriod::class); $macrosProperty = $reflection->getProperty('macros');