Issues (35)

src/Elements/Range.php (1 issue)

Labels
Severity
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 Range extends Element implements Ruleable, Descriptionable
16
{
17
    use Description;
18
    use Rules;
19
20
    protected string $type = 'range';
21
22 1
    public function setMin(string|int $min): self
23
    {
24 1
        Assert::numeric($min);
25 1
        $min = (int) $min;
26 1
        $this->setAttribute(AttributeFactory::create('min', $min));
27 1
        return $this;
28
    }
29
30
31 1
    public function setMax(int|string $max): self
32
    {
33 1
        Assert::numeric($max);
34 1
        $max = (int) $max;
35 1
        $this->setAttribute(AttributeFactory::create('max', $max));
36 1
        return $this;
37
    }
38
39
40
    /**
41
     * @param numeric $step
0 ignored issues
show
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...
42
     * @return $this
43
     */
44 1
    public function setStep(float|int|string $step): self
45
    {
46 1
        Assert::numeric($step);
47 1
        $this->setAttribute(AttributeFactory::create('step', $step));
48 1
        return $this;
49
    }
50
}
51