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

SizeTrait::size()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
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