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\AccountingDocument;
use Application\Model\ExpenseClaim;
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 (array $root, array $args, $context, ResolveInfo $info): bool {
$context
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
'resolve' => function (array $root, array $args, /** @scrutinizer ignore-unused */ $context, 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.
$info
'resolve' => function (array $root, array $args, $context, /** @scrutinizer ignore-unused */ ResolveInfo $info): bool {
$args
'resolve' => function (array $root, /** @scrutinizer ignore-unused */ array $args, $context, ResolveInfo $info): bool {
$contexts = $root['contexts'];
$contexts
$type = $root['type'];
$instance = new $type();
// Simulate an owner
// $instance->timestampCreation();
if ($instance instanceof AccountingDocument) {
$instance->setExpenseClaim(new ExpenseClaim());
}
$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.