1 | <?php |
||
2 | |||
3 | namespace Soved\Laravel\Validation\PhoneNumber\Rules; |
||
4 | |||
5 | use Illuminate\Support\Facades\App; |
||
6 | use Brick\PhoneNumber\PhoneNumber as Validator; |
||
7 | use Brick\PhoneNumber\PhoneNumberParseException; |
||
8 | |||
9 | class PhoneNumber |
||
10 | { |
||
11 | /** |
||
12 | * Determine if the validation rule passes. |
||
13 | * |
||
14 | * @param string $attribute |
||
15 | * @param mixed $value |
||
16 | * @param array $parameters |
||
17 | * @param \Illuminate\Validation\Validator $validator |
||
0 ignored issues
–
show
|
|||
18 | * @return bool |
||
19 | */ |
||
20 | public function __invoke( |
||
21 | $attribute, |
||
22 | $value = '', |
||
23 | $parameters, |
||
24 | $validator |
||
25 | ) { |
||
26 | try { |
||
27 | $phoneNumber = Validator::parse( |
||
28 | $value, |
||
29 | strtoupper(App::getLocale()) |
||
30 | ); |
||
31 | } catch (PhoneNumberParseException $e) { |
||
32 | return false; |
||
33 | } |
||
34 | |||
35 | return $phoneNumber->isValidNumber(); |
||
36 | } |
||
37 | } |
||
38 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths