for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Date: 03.12.15
*
* @author Portey Vasil <[email protected]>
*/
namespace Youshido\GraphQL\Introspection;
use Youshido\GraphQL\Type\Config\TypeConfigInterface;
use Youshido\GraphQL\Type\Object\AbstractObjectType;
use Youshido\GraphQL\Type\TypeMap;
class EnumValueType extends AbstractObjectType
{
protected function build(TypeConfigInterface $config)
$config
->addField('name', TypeMap::TYPE_STRING, [
'resolve' => function ($value, $args) {
$value
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$args
$a = 'asd';
$a
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
}
])
->addField('description', TypeMap::TYPE_STRING)
->addField('deprecationReason', TypeMap::TYPE_STRING)
->addField('isDeprecated', TypeMap::TYPE_BOOLEAN);
public function resolve($value = null, $args = [])
return null;
* @return String type name
public function getName()
return '__EnumValue';
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.