|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Form\Widget\Attribute; |
|
6
|
|
|
|
|
7
|
|
|
use Yiisoft\Html\Html; |
|
8
|
|
|
|
|
9
|
|
|
trait WithoutModelAttribute |
|
10
|
|
|
{ |
|
11
|
|
|
private string $autoIdPrefix = ''; |
|
12
|
|
|
private array $attributes = []; |
|
13
|
|
|
private string $id = ''; |
|
14
|
|
|
private string $name = ''; |
|
15
|
|
|
private string $value = ''; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* The prefix to the automatically generated widget IDs. |
|
19
|
|
|
* |
|
20
|
|
|
* @param string $value |
|
21
|
|
|
* |
|
22
|
|
|
* @return static |
|
23
|
|
|
*/ |
|
24
|
3 |
|
public function autoIdPrefix(string $value): self |
|
25
|
|
|
{ |
|
26
|
3 |
|
$new = clone $this; |
|
27
|
3 |
|
$new->autoIdPrefix = $value; |
|
28
|
3 |
|
return $new; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* The HTML attributes. The following special options are recognized. |
|
33
|
|
|
* |
|
34
|
|
|
* @param array $value |
|
35
|
|
|
* |
|
36
|
|
|
* @return static |
|
37
|
|
|
* |
|
38
|
|
|
* See {@see \Yiisoft\Html\Html::renderTagAttributes()} for details on how attributes are being rendered. |
|
39
|
|
|
*/ |
|
40
|
18 |
|
public function attributes(array $value): self |
|
41
|
|
|
{ |
|
42
|
18 |
|
$new = clone $this; |
|
43
|
18 |
|
$new->attributes = $value; |
|
44
|
18 |
|
return $new; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Set the ID of the widget. |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $id |
|
51
|
|
|
* |
|
52
|
|
|
* @return static |
|
53
|
|
|
* |
|
54
|
|
|
* @link https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute |
|
55
|
|
|
*/ |
|
56
|
3 |
|
public function id(string $id): self |
|
57
|
|
|
{ |
|
58
|
3 |
|
$new = clone $this; |
|
59
|
3 |
|
$new->id = $id; |
|
60
|
3 |
|
return $new; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* The name part of the name/value pair associated with this element for the purposes of form submission. |
|
65
|
|
|
* |
|
66
|
|
|
* @param string The name of the widget. |
|
|
|
|
|
|
67
|
|
|
* |
|
68
|
|
|
* @return static |
|
69
|
|
|
* |
|
70
|
|
|
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.reset.html#input.reset.attrs.name |
|
71
|
|
|
*/ |
|
72
|
2 |
|
public function name(string $value): self |
|
73
|
|
|
{ |
|
74
|
2 |
|
$new = clone $this; |
|
75
|
2 |
|
$new->name = $value; |
|
76
|
2 |
|
return $new; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Specifies a value for the input element. |
|
81
|
|
|
* |
|
82
|
|
|
* @param string $value |
|
83
|
|
|
* |
|
84
|
|
|
* @return static |
|
85
|
|
|
* |
|
86
|
|
|
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.reset.html#input.reset.attrs.value |
|
87
|
|
|
*/ |
|
88
|
3 |
|
public function value(string $value): self |
|
89
|
|
|
{ |
|
90
|
3 |
|
$new = clone $this; |
|
91
|
3 |
|
$new->value = $value; |
|
92
|
3 |
|
return $new; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Generates a unique ID for the attribute. |
|
97
|
|
|
* |
|
98
|
|
|
* @return string |
|
99
|
|
|
*/ |
|
100
|
28 |
|
protected function generateId(): string |
|
101
|
|
|
{ |
|
102
|
28 |
|
return $this->id = $this->id !== '' ? $this->id : Html::generateId($this->autoIdPrefix); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
28 |
|
protected function getName(): string |
|
106
|
|
|
{ |
|
107
|
28 |
|
return $this->name = $this->name !== '' ? $this->name : $this->generateId(); |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|
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