Ecodev /
my-ichtus
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | |||||
| 5 | namespace Application\Acl\Assertion; |
||||
| 6 | |||||
| 7 | use Application\Enum\BookingType; |
||||
| 8 | use Application\Model\Booking; |
||||
| 9 | use Ecodev\Felix\Acl\Assertion\NamedAssertion; |
||||
| 10 | use Laminas\Permissions\Acl\Acl; |
||||
| 11 | use Laminas\Permissions\Acl\Resource\ResourceInterface; |
||||
| 12 | use Laminas\Permissions\Acl\Role\RoleInterface; |
||||
| 13 | |||||
| 14 | class BookingIsSelfApproved implements NamedAssertion |
||||
| 15 | { |
||||
| 16 | public function getName(): string |
||||
| 17 | { |
||||
| 18 | return 'la réséveration est un carnet de sortie'; |
||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * Assert that booking's bookable is self approved (boats) or has no bookable. |
||||
| 23 | * |
||||
| 24 | * @param \Application\Acl\Acl $acl |
||||
| 25 | * @param string $privilege |
||||
| 26 | * |
||||
| 27 | * @return bool |
||||
| 28 | */ |
||||
| 29 | 3 | public function assert(Acl $acl, ?RoleInterface $role = null, ?ResourceInterface $resource = null, $privilege = null) |
|||
| 30 | { |
||||
| 31 | /** @var Booking $booking */ |
||||
| 32 | 3 | $booking = $resource->getInstance(); |
|||
|
0 ignored issues
–
show
|
|||||
| 33 | |||||
| 34 | 3 | if (!$booking->getBookable()) { |
|||
| 35 | return true; |
||||
| 36 | } |
||||
| 37 | |||||
| 38 | 3 | $bookingType = $booking->getBookable()->getBookingType(); |
|||
| 39 | 3 | if ($bookingType === BookingType::SelfApproved) { |
|||
| 40 | 1 | return true; |
|||
| 41 | } |
||||
| 42 | |||||
| 43 | 2 | return $acl->reject('the booking type for this booking is not self approved, but : ' . $bookingType->value); |
|||
|
0 ignored issues
–
show
The method
reject() does not exist on Laminas\Permissions\Acl\Acl. It seems like you code against a sub-type of Laminas\Permissions\Acl\Acl such as Ecodev\Felix\Acl\Acl.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 44 | } |
||||
| 45 | } |
||||
| 46 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.