Skip to content

Commit 3fda138

Browse files
committed
Fix method not found when Symfony/Component/Clock/DatePoint exists in DateHandler
1 parent 43bd8f4 commit 3fda138

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/Handler/DateHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function getSubscribingMethods()
6262
'type' => $type,
6363
'format' => $format,
6464
'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
65-
'method' => 'serialize' . $type,
65+
'method' => 'serialize' . str_replace('\\', '', $type),
6666
];
6767
}
6868

tests/Handler/DateHandlerTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,21 @@ public function testDatePointWithTimezone()
250250
self::assertInstanceOf(DatePoint::class, $result);
251251
self::assertEquals($timezone, $result->getTimezone()->getName());
252252
}
253+
254+
255+
public function testSubscribingMethodsExistOnClass(): void
256+
{
257+
$methods = DateHandler::getSubscribingMethods();
258+
259+
foreach ($methods as $method) {
260+
if (!isset($method['method'])) {
261+
continue;
262+
}
263+
264+
$this->assertTrue(
265+
method_exists(DateHandler::class, $method['method']),
266+
sprintf("Method %s referenced in getSubscribingMethods() does not exist on DateHandler", $method['method'])
267+
);
268+
}
269+
}
253270
}

0 commit comments

Comments
 (0)