Code Duplication    Length = 23-23 lines in 2 locations

src/Reducers/TypeHint/ArrayHintReducer.php 1 location

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

src/Reducers/TypeHint/ScalarHintReducer.php 1 location

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