GraphQL\Executor\Executor::getFieldDef PHP Method

getFieldDef() private static method

It has special casing for the two introspection fields, __schema and __typename. __typename is special because it can always be queried as a field, even in situations where no other fields are allowed, like on a Union. __schema could get automatically added to the query type, but that would require mutating type definitions, which would cause issues.
private static getFieldDef ( Schema $schema, ObjectType $parentType, $fieldName ) : FieldDefinition
$schema GraphQL\Schema
$parentType GraphQL\Type\Definition\ObjectType
$fieldName
return GraphQL\Type\Definition\FieldDefinition
    private static function getFieldDef(Schema $schema, ObjectType $parentType, $fieldName)
    {
        static $schemaMetaFieldDef, $typeMetaFieldDef, $typeNameMetaFieldDef;
        $schemaMetaFieldDef = $schemaMetaFieldDef ?: Introspection::schemaMetaFieldDef();
        $typeMetaFieldDef = $typeMetaFieldDef ?: Introspection::typeMetaFieldDef();
        $typeNameMetaFieldDef = $typeNameMetaFieldDef ?: Introspection::typeNameMetaFieldDef();
        if ($fieldName === $schemaMetaFieldDef->name && $schema->getQueryType() === $parentType) {
            return $schemaMetaFieldDef;
        } else {
            if ($fieldName === $typeMetaFieldDef->name && $schema->getQueryType() === $parentType) {
                return $typeMetaFieldDef;
            } else {
                if ($fieldName === $typeNameMetaFieldDef->name) {
                    return $typeNameMetaFieldDef;
                }
            }
        }
        $tmp = $parentType->getFields();
        return isset($tmp[$fieldName]) ? $tmp[$fieldName] : null;
    }