Issues (42)

src/Validate/Traits/BlockStringTrait.php (5 issues)

1
<?php
2
3
namespace Validate\Traits;
4
5
/**
6
 * Undocumented trait
7
 */
8
trait BlockStringTrait
9
{
10
    /**
11
     * Found many strings inside multiples arrays
12
     *
13
     * @param  array $blocks
14
     * @return boolean
15
     */
16
    public static function foundInMultiplesArrays(array $blocks): boolean
0 ignored issues
show
The type Validate\Traits\boolean 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...
17
    {
18
        foreach ($blocks as $block) {
19
            if (static::foundInArray($block[0], $block[1])) {
20
                return true;
0 ignored issues
show
Bug Best Practice introduced by
The expression return true returns the type true which is incompatible with the type-hinted return Validate\Traits\boolean.
Loading history...
21
            }
22
        }
23
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the type-hinted return Validate\Traits\boolean.
Loading history...
24
    }
25
26
    /**
27
     * Found string inside array
28
     *
29
     * @param  string $field
30
     * @param  array $array
31
     * @return bool
32
     */
33
    public static function foundInArray(string $field, array $array): boolean
34
    {
35
        foreach ($array as $notPermit) {
36
            if (strpos($field, $notPermit) !== false) {
37
                return true;
0 ignored issues
show
Bug Best Practice introduced by
The expression return true returns the type true which is incompatible with the type-hinted return Validate\Traits\boolean.
Loading history...
38
            }
39
        }
40
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the type-hinted return Validate\Traits\boolean.
Loading history...
41
    }
42
}
43