1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * This file is part of Dimtrovich/Validation. |
||||
5 | * |
||||
6 | * (c) 2023 Dimitri Sitchet Tomkeu <[email protected]> |
||||
7 | * |
||||
8 | * For the full copyright and license information, please view |
||||
9 | * the LICENSE file that was distributed with this source code. |
||||
10 | */ |
||||
11 | |||||
12 | namespace Dimtrovich\Validation\Rules; |
||||
13 | |||||
14 | use BlitzPHP\Utilities\String\Text; |
||||
15 | use DateTimeZone; |
||||
16 | |||||
17 | class Timezone extends AbstractRule |
||||
18 | { |
||||
19 | protected $fillableParams = ['settings']; |
||||
20 | |||||
21 | /** |
||||
22 | * {@inheritDoc} |
||||
23 | */ |
||||
24 | public function check($value): bool |
||||
25 | { |
||||
26 | [$timezoneGroup, $countryCode] = explode(',', $this->parameter('settings', 'ALL')) + [1 => null]; |
||||
27 | |||||
28 | return in_array($value, timezone_identifiers_list( |
||||
0 ignored issues
–
show
timezone_identifiers_lis...r($countryCode) : null) of type void is incompatible with the type array expected by parameter $haystack of in_array() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
29 | constant(DateTimeZone::class . '::' . Text::upper($timezoneGroup)), |
||||
30 | null !== $countryCode ? Text::upper($countryCode) : null, |
||||
31 | ), true); |
||||
32 | } |
||||
33 | } |
||||
34 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.