1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bdf\Form\Attribute; |
4
|
|
|
|
5
|
|
|
use Bdf\Form\Aggregate\FormBuilderInterface; |
6
|
|
|
use Bdf\Form\Aggregate\FormInterface; |
7
|
|
|
use Bdf\Form\Attribute\Processor\AttributesProcessorInterface; |
8
|
|
|
use Bdf\Form\Attribute\Processor\ConfigureFormBuilderStrategy; |
|
|
|
|
9
|
|
|
use Bdf\Form\Attribute\Processor\PostConfigureInterface; |
10
|
|
|
use Bdf\Form\Attribute\Processor\ReflectionProcessor; |
11
|
|
|
use Bdf\Form\Custom\CustomForm; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Utility class for declare a form using PHP 8 attributes and declare elements using typed properties |
15
|
|
|
* |
16
|
|
|
* @template T |
17
|
|
|
* @extends CustomForm<T> |
18
|
|
|
*/ |
19
|
|
|
abstract class AttributeForm extends CustomForm |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Implementation use to process attributes and properties |
23
|
|
|
* and for configure the form builder |
24
|
|
|
* |
25
|
|
|
* @var AttributesProcessorInterface |
26
|
|
|
* @readonly |
27
|
|
|
*/ |
28
|
|
|
private AttributesProcessorInterface $processor; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Action to perform after the form was built |
32
|
|
|
* |
33
|
|
|
* @var PostConfigureInterface|null |
34
|
|
|
*/ |
35
|
|
|
private ?PostConfigureInterface $postConfigure = null; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param FormBuilderInterface|null $builder The form builder using by CustomForm |
39
|
|
|
* @param AttributesProcessorInterface|null $processor The attributes processor. |
40
|
|
|
* By default, use ReflectionProcessor with ConfigureFormBuilderStrategy as strategy |
41
|
|
|
*/ |
42
|
141 |
|
public function __construct(?FormBuilderInterface $builder = null, ?AttributesProcessorInterface $processor = null) |
43
|
|
|
{ |
44
|
141 |
|
parent::__construct($builder); |
45
|
|
|
|
46
|
141 |
|
$this->processor = $processor ?? new ReflectionProcessor(new ConfigureFormBuilderStrategy()); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* {@inheritdoc} |
51
|
|
|
*/ |
52
|
96 |
|
protected function configure(FormBuilderInterface $builder): void |
53
|
|
|
{ |
54
|
96 |
|
$this->postConfigure = $this->processor->configureBuilder($this, $builder); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* {@inheritdoc} |
59
|
|
|
*/ |
60
|
96 |
|
public function postConfigure(FormInterface $form): void |
61
|
|
|
{ |
62
|
96 |
|
if ($this->postConfigure) { |
63
|
96 |
|
$this->postConfigure->postConfigure($this, $form); |
64
|
96 |
|
$this->postConfigure = null; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
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