forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-5207b.php
More file actions
52 lines (41 loc) · 790 Bytes
/
Copy pathbug-5207b.php
File metadata and controls
52 lines (41 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug5207b;
class OrderEntity
{
public function getOrderCustomer(): ?OrderCustomerEntity
{
return new OrderCustomerEntity();
}
}
class OrderCustomerEntity
{
public function getCustomer(): ?CustomerEntity
{
return null;
}
public function getEmail(): string
{
return '';
}
}
class CustomerEntity
{
public function getGuest(): bool
{
return true;
}
}
class GuestAuthenticator
{
public function validate(OrderEntity $order, string $s): void
{
$isOrderByGuest = $order->getOrderCustomer()?->getCustomer()?->getGuest();
if (!$isOrderByGuest) {
throw new \Exception();
}
if (mb_strtolower($s) !== mb_strtolower($order->getOrderCustomer()?->getEmail() ?: '')) {
throw new \Exception();
}
}
}