[Messenger] Do not stack retry stamp

by @jderusse

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/36810/8a929c5b4867c3746e26331e85d870dd04a0eea5/cs.diff | patch -p0
diff -ru src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php
--- src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php	2020-05-21 17:57:58.957361581 +0000
+++ src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php	2020-05-21 17:57:59.536361073 +0000
@@ -79,24 +79,24 @@
     }
 
     /**
-     * Adds stamps to the envelope by keeping only the First + Last N stamps
+     * Adds stamps to the envelope by keeping only the First + Last N stamps.
      */
     private function withLimitedHistory(Envelope $envelope, StampInterface ...$stamps): Envelope
     {
         foreach ($stamps as $stamp) {
-            $history = $envelope->all(get_class($stamp));
+            $history = $envelope->all(\get_class($stamp));
             if (\count($history) < self::HISTORY_SIZE) {
                 $envelope = $envelope->with($stamp);
                 continue;
             }
 
-            $history = \array_merge(
+            $history = array_merge(
                 [$history[0]],
                 \array_slice($history, -self::HISTORY_SIZE + 2),
                 [$stamp]
             );
 
-            $envelope = $envelope->withoutAll(get_class($stamp))->with(...$history);
+            $envelope = $envelope->withoutAll(\get_class($stamp))->with(...$history);
         }
 
         return $envelope;
diff -ru src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php
--- src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php	2020-05-21 17:57:59.225361346 +0000
+++ src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php	2020-05-21 17:57:59.608361009 +0000
@@ -80,9 +80,9 @@
     public function testEnvelopeKeepOnlyTheLast10Stamps()
     {
         $exception = new \Exception('no!');
-        $stamps = \array_merge(
-          \array_fill(0, 15, new DelayStamp(1)),
-          \array_fill(0, 3, new RedeliveryStamp(1)),
+        $stamps = array_merge(
+          array_fill(0, 15, new DelayStamp(1)),
+          array_fill(0, 3, new RedeliveryStamp(1)),
         );
         $envelope = new Envelope(new \stdClass(), $stamps);
 

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

0
Exception Messages Formatting