Completed
Push — master ( f1e5e5...9f8061 )
by Marco
07:19
created

MethodGenerator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
c 2
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromReflectionWithoutBodyAndDocBlock() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\Generator;
6
7
use Zend\Code\Generator\MethodGenerator as ZendMethodGenerator;
8
use Zend\Code\Reflection\MethodReflection;
9
10
/**
11
 * Method generator that fixes minor quirks in ZF2's method generator
12
 *
13
 * @author Marco Pivetta <[email protected]>
14
 * @license MIT
15
 */
16
class MethodGenerator extends ZendMethodGenerator
17
{
18
    /**
19
     * {@inheritDoc}
20
     */
21 19
    public static function fromReflectionWithoutBodyAndDocBlock(MethodReflection $reflectionMethod) : self
22
    {
23
        /* @var $method self */
24 19
        $method = parent::copyMethodSignature($reflectionMethod);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (copyMethodSignature() instead of fromReflectionWithoutBodyAndDocBlock()). Are you sure this is correct? If so, you might want to change this to $this->copyMethodSignature().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
25
26 19
        $method->setInterface(false);
27
28 19
        return $method;
29
    }
30
}
31