8000 add dedicated method for disabling instead of passing boolean flags · symfony/symfony@218a1ec · GitHub
[go: up one dir, main page]

Skip to content

Commit 218a1ec

Browse files
committed
add dedicated method for disabling instead of passing boolean flags
1 parent 0ca5051 commit 218a1ec

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private function removeMessages(string $failureTransportName, array $ids, Receiv
7878
try {
7979
$envelope = $receiver->find($id);
8080
} finally {
81-
$this->phpSerializer?->enableClassNotFoundCreation(false);
81+
$this->phpSerializer?->disableClassNotFoundCreation();
8282
}
8383

8484
if (null === $envelope) {

src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function runInteractive(string $failureTransportName, SymfonyStyle $io,
142142
$envelopes[] = $envelope;
143143
}
144144
} finally {
145-
$this->phpSerializer?->enableClassNotFoundCreation(false);
145+
$this->phpSerializer?->disableClassNotFoundCreation();
146146
}
147147

148148
// break the loop if all messages are consumed
@@ -216,7 +216,7 @@ private function retrySpecificIds(string $failureTransportName, array $ids, Symf
216216
try {
217217
$envelope = $receiver->find($id);
218218
} finally {
219-
$this->phpSerializer?->enableClassNotFoundCreation(false);
219+
$this->phpSerializer?->disableClassNotFoundCreation();
220220
}
221221
if (null === $envelope) {
222222
throw new RuntimeException(sprintf('The message "%s" was not found.', $id));

src/Symfony/Component/Messenger/Command/FailedMessagesShowCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private function listMessages(?string $failedTransportName, SymfonyStyle $io, in
118118
];
119119
}
120120
} finally {
121-
$this->phpSerializer?->enableClassNotFoundCreation(false);
121+
$this->phpSerializer?->disableClassNotFoundCreation();
122122
}
123123

124124
$rowsCount = \count($rows);
@@ -160,7 +160,7 @@ private function listMessagesPerClass(?string $failedTransportName, SymfonyStyle
160160
++$countPerClass[$c][1];
161161
}
162162
} finally {
163-
$this->phpSerializer?->enableClassNotFoundCreation(false);
163+
$this->phpSerializer?->disableClassNotFoundCreation();
164164
}
165165

166166
if (0 === \count($countPerClass)) {
@@ -180,7 +180,7 @@ private function showMessage(?string $failedTransportName, string $id, SymfonySt
180180
try {
181181
$envelope = $receiver->find($id);
182182
} finally {
183-
$this->phpSerializer?->enableClassNotFoundCreation(false);
183+
$this->phpSerializer?->disableClassNotFoundCreation();
184184
}
185185
if (null === $envelope) {
186186
throw new RuntimeException(sprintf('The message "%s" was not found.', $id));

src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ class PhpSerializer implements SerializerInterface
2323
{
2424
private bool $createClassNotFound = false;
2525

26-
public function enableClassNotFoundCreation(bool $enable = true): void
26+
public function enableClassNotFoundCreation(): void
2727
{
28-
$this->createClassNotFound = $enable;
28+
$this->createClassNotFound = true;
29+
}
30+
31+
public function disableClassNotFoundCreation(): void
32+
{
33+
$this->createClassNotFound = false;
2934
}
3035

3136
public function decode(array $encodedEnvelope): Envelope

0 commit comments

Comments
 (0)
0