for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Application\Api\Field\Mutation;
use Application\Api\Helper;
use Application\Model\Booking;
use Ecodev\Felix\Api\Field\FieldInterface;
use GraphQL\Type\Definition\Type;
use Mezzio\Session\SessionInterface;
abstract class TerminateBooking implements FieldInterface
{
public static function build(): array
return [
'name' => 'terminateBooking',
'type' => Type::nonNull(_types()->getOutput(Booking::class)),
'description' => 'Terminate a booking',
'args' => [
'id' => Type::nonNull(_types()->getId(Booking::class)),
'comment' => Type::string(),
],
'resolve' => function ($root, array $args, SessionInterface $session): Booking {
$session
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
'resolve' => function ($root, array $args, /** @scrutinizer ignore-unused */ SessionInterface $session): Booking {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
/** @var Booking $booking */
$booking = $args['id']->getEntity();
// Check ACL
Helper::throwIfDenied($booking, 'update');
$booking->terminate($args['comment'] ?? null);
_em()->flush();
return $booking;
},
];
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.