Code Duplication    Length = 13-15 lines in 2 locations

src/Visitor/AddProxiedMethods.php 2 locations

@@ 132-146 (lines=15) @@
129
     * @param Node\Stmt\ClassMethod $method
130
     * @return Node\Stmt\ClassMethod
131
     */
132
    private function modifyReturnMethod(Node\Stmt\ClassMethod $method): Node\Stmt\ClassMethod
133
    {
134
        $method->setDocComment(PHPDoc::writeInheritdoc());
135
136
        $resolved = Expressions::resolveMethodCall('this', $this->resolverProperty, $this->resolveMethod);
137
        $stmt = new Node\Stmt\Return_(new Node\Expr\MethodCall(
138
            $resolved,
139
            $method->name->name,
140
            $this->packMethodArgs($method)
141
        ));
142
143
        $method->stmts = [Expressions::throwExceptionOnNull($resolved, $stmt)];
144
145
        return $method;
146
    }
147
148
    /**
149
     * @param Node\Stmt\ClassMethod $method
@@ 152-164 (lines=13) @@
149
     * @param Node\Stmt\ClassMethod $method
150
     * @return Node\Stmt\ClassMethod
151
     */
152
    private function modifyExprMethod(Node\Stmt\ClassMethod $method): Node\Stmt\ClassMethod
153
    {
154
        $method->setDocComment(PHPDoc::writeInheritdoc());
155
156
        $resolved = Expressions::resolveMethodCall('this', $this->resolverProperty, $this->resolveMethod);
157
        $stmt = new Node\Stmt\Expression(
158
            new Node\Expr\MethodCall($resolved, $method->name->name, $this->packMethodArgs($method))
159
        );
160
161
        $method->stmts = [Expressions::throwExceptionOnNull($resolved, $stmt)];
162
163
        return $method;
164
    }
165
166
    /**
167
     * @param Node\Stmt\ClassMethod $method