From 3fda1386a475ff6ba9d1ea3e51178da9b5f7dd30 Mon Sep 17 00:00:00 2001 From: Michi Lehr Date: Wed, 27 May 2026 23:00:38 +0200 Subject: [PATCH] Fix method not found when Symfony/Component/Clock/DatePoint exists in DateHandler --- src/Handler/DateHandler.php | 2 +- tests/Handler/DateHandlerTest.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Handler/DateHandler.php b/src/Handler/DateHandler.php index b3dd81c7d..b7f2b64da 100644 --- a/src/Handler/DateHandler.php +++ b/src/Handler/DateHandler.php @@ -62,7 +62,7 @@ public static function getSubscribingMethods() 'type' => $type, 'format' => $format, 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, - 'method' => 'serialize' . $type, + 'method' => 'serialize' . str_replace('\\', '', $type), ]; } diff --git a/tests/Handler/DateHandlerTest.php b/tests/Handler/DateHandlerTest.php index 39ce67003..362fa733e 100644 --- a/tests/Handler/DateHandlerTest.php +++ b/tests/Handler/DateHandlerTest.php @@ -250,4 +250,21 @@ public function testDatePointWithTimezone() self::assertInstanceOf(DatePoint::class, $result); self::assertEquals($timezone, $result->getTimezone()->getName()); } + + + public function testSubscribingMethodsExistOnClass(): void + { + $methods = DateHandler::getSubscribingMethods(); + + foreach ($methods as $method) { + if (!isset($method['method'])) { + continue; + } + + $this->assertTrue( + method_exists(DateHandler::class, $method['method']), + sprintf("Method %s referenced in getSubscribingMethods() does not exist on DateHandler", $method['method']) + ); + } + } }