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

fromReflectionWithoutBodyAndDocBlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.6666
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 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