8000 fix(Serializer): Do not use `class-string` type-hint it breaks JSON s… · roadiz/core-bundle-dev-app@9ffaf6e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ffaf6e

Browse files
fix(Serializer): Do not use class-string type-hint it breaks JSON serializer symfony/symfony#47736
1 parent 25c80a0 commit 9ffaf6e

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

config/packages/messenger.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ framework:
44
# failure_transport: failed
55
reset_on_message: true
66
transports:
7-
async: '%env(MESSENGER_TRANSPORT_DSN)%'
7+
# https://symfony.com/doc/current/messenger.html#transport-configuration
8+
async:
9+
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
10+
# Use JSON message to be able to decode them in a NodeJS worker
11+
serializer: messenger.transport.symfony_serializer
812
failed: 'doctrine://default?queue_name=failed'
913
sync: 'sync://'
1014

lib/RoadizCoreBundle/src/SearchEngine/Message/AbstractSolrMessage.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
abstract class AbstractSolrMessage implements AsyncMessage
1010
{
1111
/**
12-
* @var class-string
12+
* Cannot typehint with class-string: breaks Symfony Serializer 5.4
13+
* @var string
1314
*/
1415
protected string $classname;
1516
/**
@@ -18,7 +19,7 @@ abstract class AbstractSolrMessage implements AsyncMessage
1819
protected mixed $identifier;
1920

2021
/**
21-
* @param class-string $classname
22+
* @param string $classname
2223
* @param mixed $identifier
2324
*/
2425
public function __construct(string $classname, mixed $identifier)
@@ -28,7 +29,7 @@ public function __construct(string $classname, mixed $identifier)
2829
}
2930

3031
/**
31-
* @return class-string
32+
* @return string
3233
*/
3334
public function getClassname(): string
3435
{

lib/RoadizCoreBundle/src/SearchEngine/Message/Handler/SolrDeleteMessageHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public function __invoke(SolrDeleteMessage $message): void
2525
{
2626
try {
2727
if (!empty($message->getIdentifier())) {
28+
// Cannot typehint with class-string: breaks Symfony Serializer 5.4
29+
// @phpstan-ignore-next-line
2830
$this->indexerFactory->getIndexerFor($message->getClassname())->delete($message->getIdentifier());
2931
}
3032
} catch (SolrServerNotAvailableException $exception) {

lib/RoadizCoreBundle/src/SearchEngine/Message/Handler/SolrReindexMessageHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public function __invoke(SolrReindexMessage $message): void
2525
{
2626
try {
2727
if (!empty($message->getIdentifier())) {
28+
// Cannot typehint with class-string: breaks Symfony Serializer 5.4
29+
// @phpstan-ignore-next-line
2830
$this->indexerFactory->getIndexerFor($message->getClassname())->index($message->getIdentifier());
2931
}
3032
} catch (SolrServerNotAvailableException $exception) {

0 commit comments

Comments
 (0)
0