1 | <?php |
||||
2 | |||||
3 | $input = ' hoge fuga '; |
||||
4 | $rule = ['trim', 'empty_to_null']; |
||||
5 | |||||
6 | $result = Normalizer::normalize($input, $rule); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
7 | |||||
8 | var_dump($result); |
||||
9 | // 'hoge fuga' |
||||
10 | |||||
11 | $n = new Normalizer([ |
||||
0 ignored issues
–
show
The call to
Normalizer::__construct() has too many arguments starting with array('name' => array('t...y_to_null', 'integer')) .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
12 | 'name' => ['trim', 'empty_to_null'], |
||||
13 | 'age' => ['trim', 'empty_to_null', 'integer'], |
||||
14 | 'gender' => ['trim', 'empty_to_null', 'integer'], |
||||
15 | ]); |
||||
16 | |||||
17 | $normalized = $n->normalize([ |
||||
0 ignored issues
–
show
array('name' => ' hog...uga ', 'age' => ' 20 ') of type array<string,string> is incompatible with the type string expected by parameter $input of Normalizer::normalize() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
18 | 'name' => ' hoge fuga ', |
||||
19 | 'age' => ' 20 ', |
||||
20 | ]); |
||||
21 | |||||
22 | var_dump($result); |
||||
23 | // [ |
||||
24 | // 'name' => 'hoge fuga', |
||||
25 | // 'age' => 20, |
||||
26 | // 'gender' => null, |
||||
27 | // ] |
||||
28 | |||||
29 | // Advanced Filters |
||||
30 | |||||
31 | Filter::map([ |
||||
32 | '1' => 'male', |
||||
33 | '2' => 'female', |
||||
34 | ]); |
||||
35 | Filter::substitute('aaa', 'bbb'); |
||||
36 | |||||
37 | // Add Filter |
||||
38 | |||||
39 | // Filter Set |
||||
40 | Normalizer::STRING; |
||||
0 ignored issues
–
show
|
|||||
41 | Normalizer::INTEGER; |
||||
0 ignored issues
–
show
|
|||||
42 | |||||
43 | |||||
44 | var_dump($normalized); |