Code Duplication    Length = 6-8 lines in 2 locations

src/Hal/Component/Parser/CodeParser/ReturnParser.php 2 locations

@@ 54-59 (lines=6) @@
51
52
        // PHP 7 return
53
        $closingParenthesis = $this->searcher->getNext($tokens, 0, Token::T_PARENTHESIS_CLOSE);
54
        if($closingParenthesis + 2 <= sizeof($tokens)) {
55
            if(Token::T_FUNCTION_RETURN === $tokens[$closingParenthesis + 1]) {
56
                $class = $this->namespaceResolver->resolve($tokens[$closingParenthesis + 2]);
57
                array_push($returns, new ReturnedValue($class));
58
            }
59
        }
60
61
        // returns in code
62
        $typeResolver = new TypeResolver();
@@ 76-83 (lines=8) @@
73
            if(Token::T_RETURN === $token) {
74
                // return with value
75
                $next = $tokens[$i + 1];
76
                if(Token::T_NEW === $next) {
77
                    if(!isset($tokens[$i + 2])) {
78
                        throw new IncorrectSyntaxException('"return new" without classname');
79
                    }
80
                    $classname = $tokens[$i + 2];
81
                    array_push($returns, new ReturnedValue($this->namespaceResolver->resolve($classname)));
82
                    continue;
83
                }
84
85
                // mixed value
86