Code Duplication    Length = 23-23 lines in 2 locations

src/Reducers/TypeHint/ArrayReducer.php 1 location

@@ 21-43 (lines=23) @@
18
/**
19
 * Class ArrayReducer
20
 */
21
class ArrayReducer implements ReducerInterface
22
{
23
    /**
24
     * @param RuleInterface $rule
25
     * @return bool
26
     */
27
    public function match(RuleInterface $rule): bool
28
    {
29
        return $rule->getName() === 'Array';
30
    }
31
32
    /**
33
     * @param RuleInterface $rule
34
     * @return \Generator|Matchable
35
     */
36
    public function reduce(RuleInterface $rule): \Generator
37
    {
38
        /** @var string $name */
39
        $name = yield $rule->first('Type');
40
41
        return new ArrayTypeHint($name);
42
    }
43
}
44

src/Reducers/TypeHint/ScalarReducer.php 1 location

@@ 21-43 (lines=23) @@
18
/**
19
 * Class ScalarReducer
20
 */
21
class ScalarReducer implements ReducerInterface
22
{
23
    /**
24
     * @param RuleInterface $rule
25
     * @return bool
26
     */
27
    public function match(RuleInterface $rule): bool
28
    {
29
        return $rule->getName() === 'Scalar';
30
    }
31
32
    /**
33
     * @param RuleInterface $rule
34
     * @return \Generator|Matchable
35
     */
36
    public function reduce(RuleInterface $rule): \Generator
37
    {
38
        /** @var string $name */
39
        $name = yield $rule->first('Type');
40
41
        return new ScalarTypeHint($name);
42
    }
43
}
44