Skip to content

Commit 5a43a48

Browse files
authored
Merge pull request #406 from stof/attribute
Add an attribute to mark menu builder methods
2 parents b528141 + 6860980 commit 5a43a48

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Knp\Menu\Attribute;
4+
5+
/**
6+
* A reusable attribute to help configure a class method as being a menu builder.
7+
*
8+
* Using it offers no guarantee: it needs to be leveraged by a KnpMenu third-party consumer.
9+
*
10+
* Using it with the KnpMenu library only has no effect at all: wiring the menu builder into
11+
* the menu provider is expected to be handled by framework integrations.
12+
*/
13+
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
14+
final class AsMenuBuilder
15+
{
16+
public function __construct(
17+
public readonly string $name,
18+
) {
19+
}
20+
}

0 commit comments

Comments
 (0)