8000 Allow accessing all options on a handler descriptor · symfony/symfony@885190d · GitHub
[go: up one dir, main page]

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

+5
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

+5
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

+8
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)
0