Issues (73)

src/Rules/ValidDuplicate.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Milwad\LaravelValidate\Rules;
4
5
use Illuminate\Contracts\Validation\Rule;
6
7
class ValidDuplicate implements Rule
8
{
9
    /**
10
     * Check duplicate value.
11
     */
12
    public function passes($attribute, $value): bool
13
    {
14
        $value = str_split($value);
15
16
        return collect($value)->duplicates()->isEmpty();
0 ignored issues
show
$value of type array|true is incompatible with the type Illuminate\Contracts\Support\Arrayable expected by parameter $value of collect(). ( Ignorable by Annotation )

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

16
        return collect(/** @scrutinizer ignore-type */ $value)->duplicates()->isEmpty();
Loading history...
17
    }
18
19
    /**
20
     * Get the validation error message.
21
     */
22
    public function message(): string
23
    {
24
        return __('validate.duplicate');
25
    }
26
}
27