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\Model\Statistic;
use Application\Repository\StatisticRepository;
use Ecodev\Felix\Api\Field\FieldInterface;
use GraphQL\Type\Definition\Type;
class RecordPage implements FieldInterface
{
public static function build(): array
return [
'name' => 'recordPage',
'type' => Type::nonNull(Type::boolean()),
'description' => 'Record one page visit in statistics',
'resolve' => function (array $root, array $args): bool {
$args
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, /** @scrutinizer ignore-unused */ array $args): bool {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$site = $root['site'];
/** @var StatisticRepository $statisticRepository */
$statisticRepository = _em()->getRepository(Statistic::class);
$statistic = $statisticRepository->getOrCreate($site);
$statistic->recordPage();
_em()->flush();
return true;
},
];
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.