Moved parse/serialize methods from abstract ScalarType class to LeafType interface (as EnumType implements them as well)

This commit is contained in:
vladar 2016-11-01 23:42:11 +07:00
parent e56eb6e10d
commit 8f80389ecf
2 changed files with 23 additions and 24 deletions

View File

@ -8,4 +8,27 @@ GraphQLEnumType;
*/ */
interface LeafType interface LeafType
{ {
/**
* Serializes an internal value to include in a response.
*
* @param mixed $value
* @return mixed
*/
public function serialize($value);
/**
* Parses an externally provided value to use as an input
*
* @param mixed $value
* @return mixed
*/
public function parseValue($value);
/**
* Parses an externally provided literal value to use as an input
*
* @param \GraphQL\Language\AST\Value $valueAST
* @return mixed
*/
public function parseLiteral($valueAST);
} }

View File

@ -34,28 +34,4 @@ abstract class ScalarType extends Type implements OutputType, InputType, LeafTyp
Utils::invariant($this->name, 'Type must be named.'); Utils::invariant($this->name, 'Type must be named.');
} }
/**
* Serializes an internal value to include in a response.
*
* @param mixed $value
* @return mixed
*/
abstract public function serialize($value);
/**
* Parses an externally provided value to use as an input
*
* @param mixed $value
* @return mixed
*/
abstract public function parseValue($value);
/**
* Parses an externally provided literal value to use as an input
*
* @param \GraphQL\Language\AST\Value $valueAST
* @return mixed
*/
abstract public function parseLiteral($valueAST);
} }