Passed
Pull Request — master (#192)
by Alexander
02:53
created

SizeTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A size() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Form\Field\Base;
6
7
/**
8
 * @psalm-require-extends AbstractField
9
 */
10
trait SizeTrait
11
{
12
    /**
13
     * The size of the control.
14
     *
15
     * @param int $value The number of characters that allow the user to see while editing the element's value.
16
     *
17
     * @link https://html.spec.whatwg.org/multipage/input.html#attr-input-size
18
     */
19 2
    public function size(int $value): static
20
    {
21 2
        $new = clone $this;
22 2
        $new->inputTagAttributes['size'] = $value;
0 ignored issues
show
Bug Best Practice introduced by
The property inputTagAttributes does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
23 2
        return $new;
24
    }
25
}
26