testInterceptorGeneratorWithExistingNonVoidMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 52

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 52
rs 9.0472
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManagerTest\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util;
6
7
use Laminas\Code\Generator\ParameterGenerator;
8
use Laminas\Code\Generator\PropertyGenerator;
9
use PHPUnit\Framework\MockObject\MockObject;
10
use PHPUnit\Framework\TestCase;
11
use ProxyManager\Generator\MethodGenerator;
12
use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator;
13
use ProxyManagerTestAsset\BaseClass;
14
use ProxyManagerTestAsset\VoidMethodTypeHintedInterface;
15
use ReflectionMethod;
16
17
/**
18
 * Tests for {@see \ProxyManager\ProxyGenerator\AccessInterceptorValueHolderGenerator}
19
 *
20
 * @group Coverage
21
 * @covers \ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator
22
 */
23
final class InterceptorGeneratorTest extends TestCase
24
{
25
    public function testInterceptorGenerator() : void
26
    {
27
        $method             = $this->createMock(MethodGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $method is correct as $this->createMock(\Proxy...MethodGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
28
        $bar                = $this->createMock(ParameterGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $bar is correct as $this->createMock(\Lamin...ameterGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
29
        $baz                = $this->createMock(ParameterGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $baz is correct as $this->createMock(\Lamin...ameterGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
30
        $prefixInterceptors = $this->createMock(PropertyGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $prefixInterceptors is correct as $this->createMock(\Lamin...opertyGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
31
        $suffixInterceptors = $this->createMock(PropertyGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $suffixInterceptors is correct as $this->createMock(\Lamin...opertyGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
32
33
        $bar->method('getName')->willReturn('bar');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $bar (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
34
        $baz->method('getName')->willReturn('baz');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $baz (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
35
        $method->method('getName')->willReturn('fooMethod');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $method (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
36
        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
0 ignored issues
show
Bug introduced by
The method method cannot be called on $method (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Bug introduced by
The method returnValue() does not seem to exist on object<ProxyManagerTest\...terceptorGeneratorTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
        $prefixInterceptors->method('getName')->willReturn('pre');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $prefixInterceptors (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
38
        $suffixInterceptors->method('getName')->willReturn('post');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $suffixInterceptors (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
39
40
        // @codingStandardsIgnoreStart
41
        $expected = <<<'PHP'
42
if (isset($this->pre['fooMethod'])) {
43
    $returnEarly       = false;
44
    $prefixReturnValue = $this->pre['fooMethod']->__invoke($this, $this, 'fooMethod', array('bar' => $bar, 'baz' => $baz), $returnEarly);
45
46
    if ($returnEarly) {
47
        return $prefixReturnValue;
48
    }
49
}
50
51
$returnValue = "foo";
52
53
if (isset($this->post['fooMethod'])) {
54
    $returnEarly       = false;
55
    $suffixReturnValue = $this->post['fooMethod']->__invoke($this, $this, 'fooMethod', array('bar' => $bar, 'baz' => $baz), $returnValue, $returnEarly);
56
57
    if ($returnEarly) {
58
        return $suffixReturnValue;
59
    }
60
}
61
62
return $returnValue;
63
PHP;
64
        // @codingStandardsIgnoreEnd
65
66
        self::assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...terceptorGeneratorTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
67
            $expected,
68
            InterceptorGenerator::createInterceptedMethodBody(
69
                '$returnValue = "foo";',
70
                $method,
0 ignored issues
show
Documentation introduced by
$method is of type null, but the function expects a object<ProxyManager\Generator\MethodGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
                $prefixInterceptors,
0 ignored issues
show
Documentation introduced by
$prefixInterceptors is of type null, but the function expects a object<Laminas\Code\Generator\PropertyGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
72
                $suffixInterceptors,
0 ignored issues
show
Documentation introduced by
$suffixInterceptors is of type null, but the function expects a object<Laminas\Code\Generator\PropertyGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
73
                null
74
            )
75
        );
76
    }
77
78
    public function testInterceptorGeneratorWithVoidReturnType() : void
79
    {
80
        $method             = $this->createMock(MethodGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $method is correct as $this->createMock(\Proxy...MethodGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
81
        $bar                = $this->createMock(ParameterGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $bar is correct as $this->createMock(\Lamin...ameterGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
82
        $baz                = $this->createMock(ParameterGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $baz is correct as $this->createMock(\Lamin...ameterGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
83
        $prefixInterceptors = $this->createMock(PropertyGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $prefixInterceptors is correct as $this->createMock(\Lamin...opertyGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
84
        $suffixInterceptors = $this->createMock(PropertyGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $suffixInterceptors is correct as $this->createMock(\Lamin...opertyGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
85
86
        $bar->method('getName')->willReturn('bar');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $bar (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
87
        $baz->method('getName')->willReturn('baz');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $baz (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
88
        $method->method('getName')->willReturn('fooMethod');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $method (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
89
        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
0 ignored issues
show
Bug introduced by
The method method cannot be called on $method (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Bug introduced by
The method returnValue() does not seem to exist on object<ProxyManagerTest\...terceptorGeneratorTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
90
        $prefixInterceptors->method('getName')->willReturn('pre');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $prefixInterceptors (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
91
        $suffixInterceptors->method('getName')->willReturn('post');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $suffixInterceptors (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
92
93
        // @codingStandardsIgnoreStart
94
        $expected = <<<'PHP'
95
if (isset($this->pre['fooMethod'])) {
96
    $returnEarly       = false;
97
    $prefixReturnValue = $this->pre['fooMethod']->__invoke($this, $this, 'fooMethod', array('bar' => $bar, 'baz' => $baz), $returnEarly);
98
99
    if ($returnEarly) {
100
        $prefixReturnValue;
101
return;
102
    }
103
}
104
105
$returnValue = "foo";
106
107
if (isset($this->post['fooMethod'])) {
108
    $returnEarly       = false;
109
    $suffixReturnValue = $this->post['fooMethod']->__invoke($this, $this, 'fooMethod', array('bar' => $bar, 'baz' => $baz), $returnValue, $returnEarly);
110
111
    if ($returnEarly) {
112
        $suffixReturnValue;
113
return;
114
    }
115
}
116
117
$returnValue;
118
return;
119
PHP;
120
        // @codingStandardsIgnoreEnd
121
122
        self::assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...terceptorGeneratorTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
123
            $expected,
124
            InterceptorGenerator::createInterceptedMethodBody(
125
                '$returnValue = "foo";',
126
                $method,
0 ignored issues
show
Documentation introduced by
$method is of type null, but the function expects a object<ProxyManager\Generator\MethodGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
127
                $prefixInterceptors,
0 ignored issues
show
Documentation introduced by
$prefixInterceptors is of type null, but the function expects a object<Laminas\Code\Generator\PropertyGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
128
                $suffixInterceptors,
0 ignored issues
show
Documentation introduced by
$suffixInterceptors is of type null, but the function expects a object<Laminas\Code\Generator\PropertyGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
129
                new ReflectionMethod(VoidMethodTypeHintedInterface::class, 'returnVoid')
130
            )
131
        );
132
    }
133
134
    public function testInterceptorGeneratorWithExistingNonVoidMethod() : void
135
    {
136
        $method             = $this->createMock(MethodGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $method is correct as $this->createMock(\Proxy...MethodGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
137
        $bar                = $this->createMock(ParameterGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $bar is correct as $this->createMock(\Lamin...ameterGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
138
        $baz                = $this->createMock(ParameterGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $baz is correct as $this->createMock(\Lamin...ameterGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
139
        $prefixInterceptors = $this->createMock(PropertyGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $prefixInterceptors is correct as $this->createMock(\Lamin...opertyGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
140
        $suffixInterceptors = $this->createMock(PropertyGenerator::class);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $suffixInterceptors is correct as $this->createMock(\Lamin...opertyGenerator::class) (which targets PHPUnit\Framework\TestCase::createMock()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
141
142
        $bar->method('getName')->willReturn('bar');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $bar (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
143
        $baz->method('getName')->willReturn('baz');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $baz (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
144
        $method->method('getName')->willReturn('fooMethod');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $method (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
145
        $method->method('getParameters')->will(self::returnValue([$bar, $baz]));
0 ignored issues
show
Bug introduced by
The method method cannot be called on $method (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Bug introduced by
The method returnValue() does not seem to exist on object<ProxyManagerTest\...terceptorGeneratorTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
146
        $prefixInterceptors->method('getName')->willReturn('pre');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $prefixInterceptors (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
147
        $suffixInterceptors->method('getName')->willReturn('post');
0 ignored issues
show
Bug introduced by
The method method cannot be called on $suffixInterceptors (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
148
149
        // @codingStandardsIgnoreStart
150
        $expected = <<<'PHP'
151
if (isset($this->pre['fooMethod'])) {
152
    $returnEarly       = false;
153
    $prefixReturnValue = $this->pre['fooMethod']->__invoke($this, $this, 'fooMethod', array('bar' => $bar, 'baz' => $baz), $returnEarly);
154
155
    if ($returnEarly) {
156
        return $prefixReturnValue;
157
    }
158
}
159
160
$returnValue = "foo";
161
162
if (isset($this->post['fooMethod'])) {
163
    $returnEarly       = false;
164
    $suffixReturnValue = $this->post['fooMethod']->__invoke($this, $this, 'fooMethod', array('bar' => $bar, 'baz' => $baz), $returnValue, $returnEarly);
165
166
    if ($returnEarly) {
167
        return $suffixReturnValue;
168
    }
169
}
170
171
return $returnValue;
172
PHP;
173
        // @codingStandardsIgnoreEnd
174
175
        self::assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...terceptorGeneratorTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
176
            $expected,
177
            InterceptorGenerator::createInterceptedMethodBody(
178
                '$returnValue = "foo";',
179
                $method,
0 ignored issues
show
Documentation introduced by
$method is of type null, but the function expects a object<ProxyManager\Generator\MethodGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
180
                $prefixInterceptors,
0 ignored issues
show
Documentation introduced by
$prefixInterceptors is of type null, but the function expects a object<Laminas\Code\Generator\PropertyGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
181
                $suffixInterceptors,
0 ignored issues
show
Documentation introduced by
$suffixInterceptors is of type null, but the function expects a object<Laminas\Code\Generator\PropertyGenerator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
182
                new ReflectionMethod(BaseClass::class, 'publicMethod')
183
            )
184
        );
185
    }
186
}
187