for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Application\Api\Output;
use Application\Acl\Acl;
use Application\Model\AbstractModel;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\ResolveInfo;
class CrudPermissionsType extends ObjectType
{
public function __construct()
$config = [
'name' => 'CrudPermissions',
'description' => 'Describe global permissions for currently logged in user',
'fields' => [
'create' => [
'type' => self::nonNull(self::boolean()),
'description' => 'Whether the user can create',
'resolve' => function ($root, array $args, $context, ResolveInfo $info): bool {
$info
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, $context, /** @scrutinizer ignore-unused */ ResolveInfo $info): bool {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$context
'resolve' => function ($root, array $args, /** @scrutinizer ignore-unused */ $context, ResolveInfo $info): bool {
/** @var class-string<AbstractModel> $type */
$type = $root['type'];
$instance = new $type();
$acl = new Acl();
return $acl->isCurrentUserAllowed($instance, 'create');
},
],
];
parent::__construct($config);
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.