for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* LikePost.php
*/
namespace Examples\Blog\Schema;
use Youshido\GraphQL\Type\Config\TypeConfigInterface;
use Youshido\GraphQL\Type\NonNullType;
use Youshido\GraphQL\Type\Object\AbstractObjectType;
use Youshido\GraphQL\Type\Scalar\IntType;
class LikePost extends AbstractObjectType
{
* @param null $value
* @param array $args
* @param PostType $type
* @return mixed
public function resolve($value = null, $args = [], $type = null)
return $type->resolve($value, $args);
$type
null
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:
function someFunction(A $objectMaybe = null) { if ($objectMaybe instanceof A) { $objectMaybe->doSomething(); } }
}
public function getType()
return new PostType();
public function build(TypeConfigInterface $config)
$config->addArgument('id', new NonNullType(new IntType()));
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: