Skip to content

Commit 3b20051

Browse files
committed
feature #50978 [Messenger] Allow accessing all options on a handler descriptor (ruudk)
This PR was merged into the 6.4 branch. Discussion ---------- [Messenger] Allow accessing all options on a handler descriptor | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? |no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | Currently it's only possible to use `HandlerDescriptor::getOption` to retrieve options one by one. In my situation, I want to inspect all the options, without knowing their name. Commits ------- 55e1176 Allow accessing all options on a handler descriptor
2 parents 48b0d9d + 55e1176 commit 3b20051

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/Symfony/Component/Messenger/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Deprecate `StopWorkerOnSignalsListener` in favor of using the `SignalableCommandInterface`
8+
* Add `HandlerDescriptor::getOptions`
89

910
6.3
1011
---

src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,9 @@ public function getOption(string $option): mixed
7373
{
7474
return $this->options[$option] ?? null;
7575
}
76+
77+
public function getOptions(): array
78+
{
79+
return $this->options;
80+
}
7681
}

src/Symfony/Component/Messenger/Tests/Handler/HandleDescriptorTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ public function __invoke()
4545
}
4646
}, 'class@anonymous%sHandleDescriptorTest.php%s::__invoke'];
4747
}
48+
49+
public function testGetOptions()
50+
{
51+
$options = ['option1' => 'value1', 'option2' => 'value2'];
52+
$descriptor = new HandlerDescriptor(function () {}, $options);
53+
54+
$this->assertSame($options, $descriptor->getOptions());
55+
}
4856
}
4957

5058
class DummyCommandHandlerWithSpecificMethod

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy