1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bdf\Form\Attribute\Button; |
4
|
|
|
|
5
|
|
|
use Attribute; |
6
|
|
|
use Bdf\Form\Attribute\AttributeForm; |
7
|
|
|
use Bdf\Form\Attribute\Processor\CodeGenerator\AttributesProcessorGenerator; |
8
|
|
|
use Bdf\Form\Attribute\Processor\GenerateConfiguratorStrategy; |
9
|
|
|
use Bdf\Form\Button\ButtonBuilderInterface; |
10
|
|
|
use Bdf\Form\Button\ButtonInterface; |
11
|
|
|
use Bdf\Form\RootElementInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Attribute for define the validation group to use when the related button is clicked |
15
|
|
|
* |
16
|
|
|
* Note: this attribute is not repeatable |
17
|
|
|
* |
18
|
|
|
* This attribute is equivalent to call : |
19
|
|
|
* <code> |
20
|
|
|
* $builder->button('btn')->groups(['Foo', 'Bar']); |
21
|
|
|
* </code> |
22
|
|
|
* |
23
|
|
|
* Usage: |
24
|
|
|
* <code> |
25
|
|
|
* class MyForm extends AttributeForm |
26
|
|
|
* { |
27
|
|
|
* #[Groups('Foo', 'Bar')] |
28
|
|
|
* private ButtonInterface $btn; |
29
|
|
|
* } |
30
|
|
|
* </code> |
31
|
|
|
* |
32
|
|
|
* @see ButtonBuilderInterface::groups() The called method |
33
|
|
|
* @see ButtonInterface::constraintGroups() Modify this value |
34
|
|
|
* @see RootElementInterface::constraintGroups() |
35
|
|
|
*/ |
36
|
|
|
#[Attribute(Attribute::TARGET_PROPERTY)] |
37
|
|
|
final class Groups implements ButtonBuilderAttributeInterface |
38
|
|
|
{ |
39
|
|
|
/** |
40
|
|
|
* @var list<string> |
|
|
|
|
41
|
|
|
* @readonly |
42
|
|
|
*/ |
43
|
|
|
private array $groups; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param string ...$groups List of validation groups |
47
|
|
|
* @no-named-arguments |
48
|
|
|
*/ |
49
|
4 |
|
public function __construct(string ...$groups) |
50
|
|
|
{ |
51
|
4 |
|
$this->groups = $groups; |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* {@inheritdoc} |
56
|
|
|
*/ |
57
|
1 |
|
public function applyOnButtonBuilder(AttributeForm $form, ButtonBuilderInterface $builder): void |
58
|
|
|
{ |
59
|
1 |
|
$builder->groups($this->groups); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritdoc} |
64
|
|
|
*/ |
65
|
3 |
|
public function generateCodeForButtonBuilder(AttributesProcessorGenerator $generator, AttributeForm $form): void |
66
|
|
|
{ |
67
|
3 |
|
$generator->line(' ->groups(?)', [$this->groups]); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths