Number::setMax()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Forms\Elements;
6
7
use Enjoys\Forms\AttributeFactory;
8
use Enjoys\Forms\Element;
9
use Enjoys\Forms\Interfaces\Descriptionable;
10
use Enjoys\Forms\Interfaces\Ruleable;
11
use Enjoys\Forms\Traits\Description;
12
use Enjoys\Forms\Traits\Rules;
13
use Webmozart\Assert\Assert;
14
15
class Number extends Element implements Ruleable, Descriptionable
16
{
17
    use Description;
18
    use Rules;
19
20
    protected string $type = 'number';
21
22
23 1
    public function setMin(string|int $min): self
24
    {
25 1
        Assert::numeric($min);
26 1
        $min = (int) $min;
27 1
        $this->setAttribute(AttributeFactory::create('min', $min));
28 1
        return $this;
29
    }
30
31
32 1
    public function setMax(int|string $max): self
33
    {
34 1
        Assert::numeric($max);
35 1
        $max = (int) $max;
36 1
        $this->setAttribute(AttributeFactory::create('max', $max));
37 1
        return $this;
38
    }
39
40
41
    /**
42
     * @param numeric $step
0 ignored issues
show
Bug introduced by
The type Enjoys\Forms\Elements\numeric was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
     * @return $this
44
     */
45 1
    public function setStep(float|int|string $step): self
46
    {
47 1
        Assert::numeric($step);
48 1
        $this->setAttribute(AttributeFactory::create('step', $step));
49 1
        return $this;
50
    }
51
}
52