CharField::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Lepton\Boson\DataTypes;
4
5
#[\Attribute]
6
class CharField extends Field
7
{
8
    public function __construct(private int $max_length = 64, mixed ...$options)
9
    {
10
        parent::__construct(...$options);
0 ignored issues
show
Bug introduced by
$options is expanded, but the parameter $null of Lepton\Boson\DataTypes\Field::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

10
        parent::__construct(/** @scrutinizer ignore-type */ ...$options);
Loading history...
11
    }
12
13
    public function validate($value)
14
    {
15
        if(strlen($value) > $this->max_length) return false;
16
        return parent::validate($value);
17
    }
18
}
19