DateField::validate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 1
1
<?php
2
namespace Lepton\Boson\DataTypes;
3
4
#[\Attribute]
5
class DateField extends Field{
6
  public function __construct(...$args){
7
    parent::__construct(...$args);
0 ignored issues
show
Bug introduced by
$args 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

7
    parent::__construct(/** @scrutinizer ignore-type */ ...$args);
Loading history...
8
  }
9
10
  public function validate($value){
11
    if (!preg_match("/\d{4}-\d{2}-\d{2}/", $value)) return false;
12
    return parent::validate($value);
13
  }
14
15
}