Skip to content

Commit 885190d

Browse files
committed
Allow accessing all options on a handler descriptor
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.
1 parent 80f1096 commit 885190d

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/Symfony/Component/Messenger/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.4
5+
---
6+
7+
* Add `HandlerDescriptor::getOptions`
8+
49
6.3
510
---
611

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