Code Duplication    Length = 12-12 lines in 2 locations

src/Type/Definition/Types/Scalars/FloatType.php 1 location

@@ 28-39 (lines=12) @@
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function coerceLiteral(Node $node)
29
    {
30
        if ($node instanceof IntValue || $node instanceof FloatValue) {
31
            $num = (float) $node->get('value');
32
33
            if ($num <= PHP_INT_MAX && $num >= -PHP_INT_MAX) {
34
                return $num;
35
            }
36
        }
37
38
        return NULL;
39
    }
40
}
41

src/Type/Definition/Types/Scalars/IntType.php 1 location

@@ 31-42 (lines=12) @@
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function coerceLiteral(Node $node)
32
    {
33
        if ($node instanceof IntValue) {
34
            $num = $node->get('value');
35
36
            if ($num <= PHP_INT_MAX && $num >= -PHP_INT_MAX) {
37
                return intval($num);
38
            }
39
        }
40
41
        return NULL;
42
    }
43
}
44