Completed
Push — master ( 346488...5472e0 )
by Eric
8s
created

ParameterResolverTest::testResolveVoterDefault()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 15
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Bundle\ResourceBundle\Tests\Routing;
13
14
use Lug\Bundle\ResourceBundle\Routing\ParameterResolver;
15
use Lug\Component\Resource\Model\ResourceInterface;
16
use Symfony\Component\HttpFoundation\ParameterBag;
17
use Symfony\Component\HttpFoundation\Request;
18
use Symfony\Component\HttpFoundation\RequestStack;
19
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
20
21
/**
22
 * @author GeLo <[email protected]>
23
 */
24
class ParameterResolverTest extends \PHPUnit_Framework_TestCase
25
{
26
    /**
27
     * @var ParameterResolver
28
     */
29
    private $parameterResolver;
30
31
    /**
32
     * @var \PHPUnit_Framework_MockObject_MockObject|RequestStack
33
     */
34
    private $requestStack;
35
36
    /**
37
     * @var \PHPUnit_Framework_MockObject_MockObject|PropertyAccessorInterface
38
     */
39
    private $propertyAccessor;
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function setUp()
45
    {
46
        $this->requestStack = $this->createRequestStackMock();
47
        $this->propertyAccessor = $this->createPropertyAccessorMock();
48
49
        $this->parameterResolver = new ParameterResolver($this->requestStack, $this->propertyAccessor);
50
    }
51
52
    public function testResolveApiWithoutRequest()
53
    {
54
        $this->assertFalse($this->parameterResolver->resolveApi());
55
    }
56
57 View Code Duplication
    public function testResolveApiWihApiRequest()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
60
            ->expects($this->exactly(2))
61
            ->method('getMasterRequest')
62
            ->will($this->returnValue($request = $this->createRequestMock()));
63
64
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
65
            ->expects($this->once())
66
            ->method('get')
67
            ->with($this->identicalTo('_lug_api'), $this->identicalTo(false))
68
            ->will($this->returnValue(true));
69
70
        $this->assertTrue($this->parameterResolver->resolveApi());
71
    }
72
73 View Code Duplication
    public function testResolveApiWithHtmlRequest()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
74
    {
75
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
76
            ->expects($this->exactly(2))
77
            ->method('getMasterRequest')
78
            ->will($this->returnValue($request = $this->createRequestMock()));
79
80
        $request
81
            ->expects($this->once())
82
            ->method('getRequestFormat')
83
            ->will($this->returnValue('html'));
84
85
        $this->assertFalse($this->parameterResolver->resolveApi());
86
    }
87
88 View Code Duplication
    public function testResolveApiWithCustomRequest()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
91
            ->expects($this->exactly(2))
92
            ->method('getMasterRequest')
93
            ->will($this->returnValue($request = $this->createRequestMock()));
94
95
        $request
96
            ->expects($this->once())
97
            ->method('getRequestFormat')
98
            ->will($this->returnValue('json'));
99
100
        $this->assertTrue($this->parameterResolver->resolveApi());
101
    }
102
103
    public function testResolveCriteriaWithoutRequest()
104
    {
105
        $this->assertEmpty($this->parameterResolver->resolveCriteria());
106
    }
107
108 View Code Duplication
    public function testResolveCriteriaWithDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
109
    {
110
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
111
            ->expects($this->exactly(2))
112
            ->method('getMasterRequest')
113
            ->will($this->returnValue($request = $this->createRequestMock()));
114
115
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
116
            ->expects($this->once())
117
            ->method('get')
118
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo([$identifier = 'id']))
119
            ->will($this->returnValue([$identifier]));
120
121
        $request
122
            ->expects($this->once())
123
            ->method('get')
124
            ->with($this->identicalTo($identifier), $this->isNull())
125
            ->will($this->returnValue($value = 'value'));
126
127
        $this->assertSame([$identifier => $value], $this->parameterResolver->resolveCriteria());
128
    }
129
130 View Code Duplication
    public function testResolveCriteriaWithExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
131
    {
132
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
133
            ->expects($this->exactly(2))
134
            ->method('getMasterRequest')
135
            ->will($this->returnValue($request = $this->createRequestMock()));
136
137
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
138
            ->expects($this->once())
139
            ->method('get')
140
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo(['id']))
141
            ->will($this->returnValue([$identifier = 'code']));
142
143
        $request
144
            ->expects($this->once())
145
            ->method('get')
146
            ->with($this->identicalTo($identifier), $this->isNull())
147
            ->will($this->returnValue($value = 'value'));
148
149
        $this->assertSame([$identifier => $value], $this->parameterResolver->resolveCriteria());
150
    }
151
152
    /**
153
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RequestNotFoundException
154
     * @expectedExceptionMessage The request could not be found.
155
     */
156
    public function testResolveCriteriaMandatoryWithoutRequest()
157
    {
158
        $this->parameterResolver->resolveCriteria(true);
159
    }
160
161
    /**
162
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
163
     * @expectedExceptionMessage The criteria could not be found for the route "route".
164
     */
165 View Code Duplication
    public function testResolveCriteriaMandatoryWithoutCriteria()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
166
    {
167
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
168
            ->expects($this->exactly(2))
169
            ->method('getMasterRequest')
170
            ->will($this->returnValue($request = $this->createRequestMock()));
171
172
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
173
            ->expects($this->at(0))
174
            ->method('get')
175
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo(['id']))
176
            ->will($this->returnValue([]));
177
178
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
179
            ->expects($this->at(1))
180
            ->method('get')
181
            ->with($this->identicalTo('_route'), $this->isNull())
182
            ->will($this->returnValue('route'));
183
184
        $this->parameterResolver->resolveCriteria(true);
185
    }
186
187
    /**
188
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
189
     * @expectedExceptionMessage The criteria "id" could not be found for the route "route".
190
     */
191
    public function testResolveCriteriaMandatoryWithoutRequestCriteria()
192
    {
193
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
194
            ->expects($this->exactly(2))
195
            ->method('getMasterRequest')
196
            ->will($this->returnValue($request = $this->createRequestMock()));
197
198
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
199
            ->expects($this->at(0))
200
            ->method('get')
201
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo([$identifier = 'id']))
202
            ->will($this->returnValue([$identifier]));
203
204
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
205
            ->expects($this->at(1))
206
            ->method('get')
207
            ->with($this->identicalTo('_route'), $this->isNull())
208
            ->will($this->returnValue('route'));
209
210
        $request
211
            ->expects($this->once())
212
            ->method('get')
213
            ->with($this->identicalTo($identifier), $this->isNull())
214
            ->will($this->returnValue(null));
215
216
        $this->parameterResolver->resolveCriteria(true);
217
    }
218
219
    public function testResolveCurrentPageWithoutRequest()
220
    {
221
        $this->assertSame(1, $this->parameterResolver->resolveCurrentPage());
222
    }
223
224
    public function testResolveCurrentPageDefault()
225
    {
226
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
227
            ->expects($this->exactly(2))
228
            ->method('getMasterRequest')
229
            ->will($this->returnValue($request = $this->createRequestMock()));
230
231
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
232
            ->expects($this->once())
233
            ->method('get')
234
            ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo($pageParameter = 'page'))
235
            ->will($this->returnValue($pageParameter));
236
237
        $request
238
            ->expects($this->once())
239
            ->method('get')
240
            ->with($this->identicalTo($pageParameter), $this->identicalTo($page = 1))
241
            ->will($this->returnValue($page));
242
243
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
244
    }
245
246 View Code Duplication
    public function testResolveCurrentPageExplicitParameter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
247
    {
248
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
249
            ->expects($this->exactly(2))
250
            ->method('getMasterRequest')
251
            ->will($this->returnValue($request = $this->createRequestMock()));
252
253
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
254
            ->expects($this->once())
255
            ->method('get')
256
            ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo('page'))
257
            ->will($this->returnValue($pageParameter = 'p'));
258
259
        $request
260
            ->expects($this->once())
261
            ->method('get')
262
            ->with($this->identicalTo($pageParameter), $this->identicalTo($page = 1))
263
            ->will($this->returnValue($page));
264
265
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
266
    }
267
268 View Code Duplication
    public function testResolveCurrentPageExplicitPage()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
269
    {
270
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
271
            ->expects($this->exactly(2))
272
            ->method('getMasterRequest')
273
            ->will($this->returnValue($request = $this->createRequestMock()));
274
275
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
276
            ->expects($this->once())
277
            ->method('get')
278
            ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo($pageParameter = 'page'))
279
            ->will($this->returnValue($pageParameter));
280
281
        $request
282
            ->expects($this->once())
283
            ->method('get')
284
            ->with($this->identicalTo($pageParameter), $this->identicalTo(1))
285
            ->will($this->returnValue($page = 2));
286
287
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
288
    }
289
290
    public function testResolveFormWithoutRequest()
291
    {
292
        $resource = $this->createResourceMock();
293
        $resource
294
            ->expects($this->once())
295
            ->method('getForm')
296
            ->will($this->returnValue($form = 'form'));
297
298
        $this->assertSame($form, $this->parameterResolver->resolveForm($resource));
299
    }
300
301
    public function testResolveFormDefault()
302
    {
303
        $resource = $this->createResourceMock();
304
        $resource
305
            ->expects($this->once())
306
            ->method('getForm')
307
            ->will($this->returnValue($form = 'form'));
308
309
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
310
            ->expects($this->once())
311
            ->method('getMasterRequest')
312
            ->will($this->returnValue($request = $this->createRequestMock()));
313
314
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
315
            ->expects($this->once())
316
            ->method('get')
317
            ->with($this->identicalTo('_lug_form'), $this->identicalTo($form))
318
            ->will($this->returnValue($form));
319
320
        $this->assertSame($form, $this->parameterResolver->resolveForm($resource));
321
    }
322
323
    public function testResolveFormExplicit()
324
    {
325
        $resource = $this->createResourceMock();
326
        $resource
327
            ->expects($this->once())
328
            ->method('getForm')
329
            ->will($this->returnValue($form = 'form'));
330
331
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
332
            ->expects($this->once())
333
            ->method('getMasterRequest')
334
            ->will($this->returnValue($request = $this->createRequestMock()));
335
336
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
337
            ->expects($this->once())
338
            ->method('get')
339
            ->with($this->identicalTo('_lug_form'), $this->identicalTo($form))
340
            ->will($this->returnValue($explicitForm = 'explicit_form'));
341
342
        $this->assertSame($explicitForm, $this->parameterResolver->resolveForm($resource));
343
    }
344
345
    public function testResolveGrid()
346
    {
347
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
348
            ->expects($this->exactly(2))
349
            ->method('getMasterRequest')
350
            ->will($this->returnValue($request = $this->createRequestMock()));
351
352
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
353
            ->expects($this->once())
354
            ->method('get')
355
            ->with($this->identicalTo('_lug_grid'), $this->identicalTo([]))
356
            ->will($this->returnValue($grid = ['foo' => 'bar']));
357
358
        $this->assertSame(
359
            array_merge(['resource' => $resource = $this->createResourceMock()], $grid),
360
            $this->parameterResolver->resolveGrid($resource)
361
        );
362
    }
363
364
    /**
365
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RequestNotFoundException
366
     * @expectedExceptionMessage The request could not be found.
367
     */
368
    public function testResolveGridWithoutRequest()
369
    {
370
        $this->parameterResolver->resolveGrid($this->createResourceMock());
371
    }
372
373
    public function testResolveHateoasWithoutRequest()
374
    {
375
        $this->assertFalse($this->parameterResolver->resolveHateoas());
376
    }
377
378
    public function testResolveHateoasDefault()
379
    {
380
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
381
            ->expects($this->once())
382
            ->method('getMasterRequest')
383
            ->will($this->returnValue($request = $this->createRequestMock()));
384
385
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
386
            ->expects($this->once())
387
            ->method('get')
388
            ->with($this->identicalTo('_lug_hateoas'), $this->identicalTo($hateaos = false))
389
            ->will($this->returnValue($hateaos));
390
391
        $this->assertFalse($this->parameterResolver->resolveHateoas());
392
    }
393
394 View Code Duplication
    public function testResolveHateoasExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
395
    {
396
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
397
            ->expects($this->once())
398
            ->method('getMasterRequest')
399
            ->will($this->returnValue($request = $this->createRequestMock()));
400
401
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
402
            ->expects($this->once())
403
            ->method('get')
404
            ->with($this->identicalTo('_lug_hateoas'), $this->identicalTo(false))
405
            ->will($this->returnValue(true));
406
407
        $this->assertTrue($this->parameterResolver->resolveHateoas());
408
    }
409
410
    public function testResolveLocationRoute()
411
    {
412
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
413
            ->expects($this->exactly(2))
414
            ->method('getMasterRequest')
415
            ->will($this->returnValue($request = $this->createRequestMock()));
416
417
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
418
            ->expects($this->once())
419
            ->method('get')
420
            ->with($this->identicalTo('_lug_location_route'), $this->isNull())
421
            ->will($this->returnValue($route = 'route'));
422
423
        $this->assertSame($route, $this->parameterResolver->resolveLocationRoute());
424
    }
425
426
    /**
427
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RequestNotFoundException
428
     * @expectedExceptionMessage The request could not be found.
429
     */
430
    public function testResolveLocationRouteWithoutRequest()
431
    {
432
        $this->parameterResolver->resolveLocationRoute();
433
    }
434
435
    /**
436
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
437
     * @expectedExceptionMessage The location route could not be found for the route "route".
438
     */
439 View Code Duplication
    public function testResolveLocationRouteMissing()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
440
    {
441
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
442
            ->expects($this->exactly(2))
443
            ->method('getMasterRequest')
444
            ->will($this->returnValue($request = $this->createRequestMock()));
445
446
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
447
            ->expects($this->at(0))
448
            ->method('get')
449
            ->with($this->identicalTo('_lug_location_route'), $this->isNull())
450
            ->will($this->returnValue(null));
451
452
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
453
            ->expects($this->at(1))
454
            ->method('get')
455
            ->with($this->identicalTo('_route'), $this->isNull())
456
            ->will($this->returnValue('route'));
457
458
        $this->parameterResolver->resolveLocationRoute();
459
    }
460
461
    public function testResolveLocationRouteParametersWithoutRequest()
462
    {
463
        $this->assertEmpty($this->parameterResolver->resolveLocationRouteParameters(new \stdClass()));
464
    }
465
466
    public function testResolveLocationRouteParametersDefault()
467
    {
468
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
469
            ->expects($this->once())
470
            ->method('getMasterRequest')
471
            ->will($this->returnValue($request = $this->createRequestMock()));
472
473
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
474
            ->expects($this->once())
475
            ->method('get')
476
            ->with($this->identicalTo('_lug_location_route_parameters'), $this->identicalTo($parameters = []))
477
            ->will($this->returnValue($parameters));
478
479
        $this->assertEmpty($this->parameterResolver->resolveLocationRouteParameters(new \stdClass()));
480
    }
481
482 View Code Duplication
    public function testResolveLocationRouteParametersExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
483
    {
484
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
485
            ->expects($this->once())
486
            ->method('getMasterRequest')
487
            ->will($this->returnValue($request = $this->createRequestMock()));
488
489
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
490
            ->expects($this->once())
491
            ->method('get')
492
            ->with($this->identicalTo('_lug_location_route_parameters'), $this->identicalTo([]))
493
            ->will($this->returnValue([$parameter = 'id']));
494
495
        $object = new \stdClass();
496
        $object->{$parameter} = $value = 1;
497
498
        $this->propertyAccessor
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Proper...opertyAccessorInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
499
            ->expects($this->once())
500
            ->method('getValue')
501
            ->with($this->identicalTo($object), $this->identicalTo($parameter))
502
            ->will($this->returnValue($value));
503
504
        $this->assertSame([$parameter => $value], $this->parameterResolver->resolveLocationRouteParameters($object));
505
    }
506
507
    public function testResolveMaxPerPageWithoutRequest()
508
    {
509
        $this->assertSame(10, $this->parameterResolver->resolveMaxPerPage());
510
    }
511
512
    public function testResolveMaxPerPageDefault()
513
    {
514
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
515
            ->expects($this->once())
516
            ->method('getMasterRequest')
517
            ->will($this->returnValue($request = $this->createRequestMock()));
518
519
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
520
            ->expects($this->once())
521
            ->method('get')
522
            ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo($maxPerPage = 10))
523
            ->will($this->returnValue($maxPerPage));
524
525
        $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage());
526
    }
527
528
    public function testResolveMaxPerPageExplicit()
529
    {
530
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
531
            ->expects($this->once())
532
            ->method('getMasterRequest')
533
            ->will($this->returnValue($request = $this->createRequestMock()));
534
535
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
536
            ->expects($this->once())
537
            ->method('get')
538
            ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo(10))
539
            ->will($this->returnValue($maxPerPage = 5));
540
541
        $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage());
542
    }
543
544
    public function testResolveRedirectRoute()
545
    {
546
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
547
            ->expects($this->exactly(2))
548
            ->method('getMasterRequest')
549
            ->will($this->returnValue($request = $this->createRequestMock()));
550
551
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
552
            ->expects($this->once())
553
            ->method('get')
554
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
555
            ->will($this->returnValue($route = 'route'));
556
557
        $this->assertSame($route, $this->parameterResolver->resolveRedirectRoute());
558
    }
559
560
    /**
561
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RequestNotFoundException
562
     * @expectedExceptionMessage The request could not be found.
563
     */
564
    public function testResolveRedirectRouteWithoutRequest()
565
    {
566
        $this->parameterResolver->resolveRedirectRoute();
567
    }
568
569
    /**
570
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
571
     * @expectedExceptionMessage The redirect route could not be found for the route "route".
572
     */
573 View Code Duplication
    public function testResolveRedirectRouteMissing()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
574
    {
575
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
576
            ->expects($this->exactly(2))
577
            ->method('getMasterRequest')
578
            ->will($this->returnValue($request = $this->createRequestMock()));
579
580
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
581
            ->expects($this->at(0))
582
            ->method('get')
583
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
584
            ->will($this->returnValue(null));
585
586
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
587
            ->expects($this->at(1))
588
            ->method('get')
589
            ->with($this->identicalTo('_route'), $this->isNull())
590
            ->will($this->returnValue('route'));
591
592
        $this->parameterResolver->resolveRedirectRoute();
593
    }
594
595
    public function testResolveRedirectRouteParametersWithoutRequest()
596
    {
597
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters(new \stdClass()));
598
    }
599
600
    public function testResolveRedirectRouteParametersDefault()
601
    {
602
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
603
            ->expects($this->once())
604
            ->method('getMasterRequest')
605
            ->will($this->returnValue($request = $this->createRequestMock()));
606
607
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
608
            ->expects($this->once())
609
            ->method('get')
610
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo($parameters = []))
611
            ->will($this->returnValue($parameters));
612
613
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters(new \stdClass()));
614
    }
615
616 View Code Duplication
    public function testResolveRedirectRouteParametersExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
617
    {
618
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
619
            ->expects($this->once())
620
            ->method('getMasterRequest')
621
            ->will($this->returnValue($request = $this->createRequestMock()));
622
623
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
624
            ->expects($this->once())
625
            ->method('get')
626
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
627
            ->will($this->returnValue([$parameter = 'id']));
628
629
        $object = new \stdClass();
630
        $object->{$parameter} = $value = 1;
631
632
        $this->propertyAccessor
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Proper...opertyAccessorInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
633
            ->expects($this->once())
634
            ->method('getValue')
635
            ->with($this->identicalTo($object), $this->identicalTo($parameter))
636
            ->will($this->returnValue($value));
637
638
        $this->assertSame([$parameter => $value], $this->parameterResolver->resolveRedirectRouteParameters($object));
639
    }
640
641
    public function testResolveRedirectRouteParametersForwardParameters()
642
    {
643
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
644
            ->expects($this->exactly(2))
645
            ->method('getMasterRequest')
646
            ->will($this->returnValue($request = $this->createRequestMock()));
647
648
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
649
            ->expects($this->once())
650
            ->method('get')
651
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
652
            ->will($this->returnValue([$parameter = 'id']));
653
654
        $request->query = $this->createParameterBagMock();
0 ignored issues
show
Bug introduced by
Accessing query on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
655
        $request->query
0 ignored issues
show
Bug introduced by
Accessing query on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
656
            ->expects($this->once())
657
            ->method('all')
658
            ->will($this->returnValue($query = ['foo' => 'bar']));
659
660
        $object = new \stdClass();
661
        $object->{$parameter} = $value = 1;
662
663
        $this->propertyAccessor
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Proper...opertyAccessorInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
664
            ->expects($this->once())
665
            ->method('getValue')
666
            ->with($this->identicalTo($object), $this->identicalTo($parameter))
667
            ->will($this->returnValue($value));
668
669
        $this->assertSame(
670
            array_merge($query, [$parameter => $value]),
671
            $this->parameterResolver->resolveRedirectRouteParameters($object, true)
672
        );
673
    }
674
675 View Code Duplication
    public function testResolveRedirectRouteParametersWithoutObject()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
676
    {
677
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
678
            ->expects($this->once())
679
            ->method('getMasterRequest')
680
            ->will($this->returnValue($request = $this->createRequestMock()));
681
682
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
683
            ->expects($this->once())
684
            ->method('get')
685
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
686
            ->will($this->returnValue([]));
687
688
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters());
689
    }
690
691
    /**
692
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
693
     * @expectedExceptionMessage The route parameters could not be found for the route "redirect_route_parameters".
694
     */
695 View Code Duplication
    public function testResolveRedirectRouteParametersWithObjectMissing()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
696
    {
697
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
698
            ->expects($this->once())
699
            ->method('getMasterRequest')
700
            ->will($this->returnValue($request = $this->createRequestMock()));
701
702
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
703
            ->expects($this->once())
704
            ->method('get')
705
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
706
            ->will($this->returnValue(['id']));
707
708
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters());
709
    }
710
711
    public function testResolveRedirectRouteParametersForwardWithoutRequest()
712
    {
713
        $this->assertFalse($this->parameterResolver->resolveRedirectRouteParametersForward());
714
    }
715
716
    public function testResolveRedirectRouteParametersForwardDefault()
717
    {
718
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
719
            ->expects($this->once())
720
            ->method('getMasterRequest')
721
            ->will($this->returnValue($request = $this->createRequestMock()));
722
723
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
724
            ->expects($this->once())
725
            ->method('get')
726
            ->with($this->identicalTo('_lug_redirect_route_parameters_forward'), $this->identicalTo($forward = false))
727
            ->will($this->returnValue($forward));
728
729
        $this->assertFalse($this->parameterResolver->resolveRedirectRouteParametersForward());
730
    }
731
732 View Code Duplication
    public function testResolveRedirectRouteParametersForwardExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
733
    {
734
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
735
            ->expects($this->once())
736
            ->method('getMasterRequest')
737
            ->will($this->returnValue($request = $this->createRequestMock()));
738
739
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
740
            ->expects($this->once())
741
            ->method('get')
742
            ->with($this->identicalTo('_lug_redirect_route_parameters_forward'), $this->identicalTo(false))
743
            ->will($this->returnValue(true));
744
745
        $this->assertTrue($this->parameterResolver->resolveRedirectRouteParametersForward());
746
    }
747
748
    public function testResolveRepositoryMethodWithoutRequest()
749
    {
750
        $this->assertSame('findForTest', $this->parameterResolver->resolveRepositoryMethod('test'));
751
    }
752
753
    public function testResolveRepositoryMethodDefault()
754
    {
755
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
756
            ->expects($this->once())
757
            ->method('getMasterRequest')
758
            ->will($this->returnValue($request = $this->createRequestMock()));
759
760
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
761
            ->expects($this->once())
762
            ->method('get')
763
            ->with($this->identicalTo('_lug_repository_method'), $this->identicalTo($repositoryMethod = 'findForTest'))
764
            ->will($this->returnValue($repositoryMethod));
765
766
        $this->assertSame($repositoryMethod, $this->parameterResolver->resolveRepositoryMethod('test'));
767
    }
768
769
    public function testResolveRepositoryMethodExplicit()
770
    {
771
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
772
            ->expects($this->once())
773
            ->method('getMasterRequest')
774
            ->will($this->returnValue($request = $this->createRequestMock()));
775
776
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
777
            ->expects($this->once())
778
            ->method('get')
779
            ->with($this->identicalTo('_lug_repository_method'), $this->identicalTo('findForTest'))
780
            ->will($this->returnValue($repositoryMethod = 'findForAction'));
781
782
        $this->assertSame($repositoryMethod, $this->parameterResolver->resolveRepositoryMethod('test'));
783
    }
784
785
    public function testResolveSerializerGroupsWithoutRequest()
786
    {
787
        $this->assertEmpty($this->parameterResolver->resolveSerializerGroups());
788
    }
789
790 View Code Duplication
    public function testResolveSerializerGroupsDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
791
    {
792
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
793
            ->expects($this->once())
794
            ->method('getMasterRequest')
795
            ->will($this->returnValue($request = $this->createRequestMock()));
796
797
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
798
            ->expects($this->once())
799
            ->method('get')
800
            ->with(
801
                $this->identicalTo('_lug_serializer_groups'),
802
                $this->identicalTo($groups = [])
803
            )
804
            ->will($this->returnValue($groups));
805
806
        $this->assertEmpty($this->parameterResolver->resolveSerializerGroups());
807
    }
808
809
    public function testResolveSerializerGroupsExplicit()
810
    {
811
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
812
            ->expects($this->once())
813
            ->method('getMasterRequest')
814
            ->will($this->returnValue($request = $this->createRequestMock()));
815
816
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
817
            ->expects($this->once())
818
            ->method('get')
819
            ->with(
820
                $this->identicalTo('_lug_serializer_groups'),
821
                $this->identicalTo([])
822
            )
823
            ->will($this->returnValue($groups = ['group']));
824
825
        $this->assertSame($groups, $this->parameterResolver->resolveSerializerGroups());
826
    }
827
828
    public function testResolveSerializerNullWithoutRequest()
829
    {
830
        $this->assertTrue($this->parameterResolver->resolveSerializerNull());
831
    }
832
833 View Code Duplication
    public function testResolveSerializerNullDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
834
    {
835
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
836
            ->expects($this->once())
837
            ->method('getMasterRequest')
838
            ->will($this->returnValue($request = $this->createRequestMock()));
839
840
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
841
            ->expects($this->once())
842
            ->method('get')
843
            ->with($this->identicalTo('_lug_serializer_null'), $this->identicalTo($null = true))
844
            ->will($this->returnValue($null));
845
846
        $this->assertTrue($this->parameterResolver->resolveSerializerNull());
847
    }
848
849
    public function testResolveSerializerNullExplicit()
850
    {
851
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
852
            ->expects($this->once())
853
            ->method('getMasterRequest')
854
            ->will($this->returnValue($request = $this->createRequestMock()));
855
856
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
857
            ->expects($this->once())
858
            ->method('get')
859
            ->with($this->identicalTo('_lug_serializer_null'), $this->identicalTo(true))
860
            ->will($this->returnValue(false));
861
862
        $this->assertFalse($this->parameterResolver->resolveSerializerNull());
863
    }
864
865
    public function testResolveSortingWithoutRequest()
866
    {
867
        $this->assertEmpty($this->parameterResolver->resolveSorting());
868
    }
869
870 View Code Duplication
    public function testResolveSortingDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
871
    {
872
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
873
            ->expects($this->once())
874
            ->method('getMasterRequest')
875
            ->will($this->returnValue($request = $this->createRequestMock()));
876
877
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
878
            ->expects($this->once())
879
            ->method('get')
880
            ->with($this->identicalTo('_lug_sorting'), $this->identicalTo($sorting = []))
881
            ->will($this->returnValue($sorting));
882
883
        $this->assertEmpty($this->parameterResolver->resolveSorting());
884
    }
885
886 View Code Duplication
    public function testResolveSortingExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
887
    {
888
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
889
            ->expects($this->once())
890
            ->method('getMasterRequest')
891
            ->will($this->returnValue($request = $this->createRequestMock()));
892
893
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
894
            ->expects($this->once())
895
            ->method('get')
896
            ->with($this->identicalTo('_lug_sorting'), $this->identicalTo([]))
897
            ->will($this->returnValue($sorting = ['foo' => 'ASC']));
898
899
        $this->assertSame($sorting, $this->parameterResolver->resolveSorting());
900
    }
901
902
    public function testResolveStatusCodeWithoutRequest()
903
    {
904
        $this->assertSame($statusCode = 200, $this->parameterResolver->resolveStatusCode($statusCode));
905
    }
906
907 View Code Duplication
    public function testResolveStatusCodeDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
908
    {
909
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
910
            ->expects($this->once())
911
            ->method('getMasterRequest')
912
            ->will($this->returnValue($request = $this->createRequestMock()));
913
914
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
915
            ->expects($this->once())
916
            ->method('get')
917
            ->with($this->identicalTo('_lug_status_code'), $this->identicalTo($statusCode = 200))
918
            ->will($this->returnValue($statusCode));
919
920
        $this->assertSame($statusCode, $this->parameterResolver->resolveStatusCode($statusCode));
921
    }
922
923
    public function testResolveStatusCodeExplicit()
924
    {
925
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
926
            ->expects($this->once())
927
            ->method('getMasterRequest')
928
            ->will($this->returnValue($request = $this->createRequestMock()));
929
930
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
931
            ->expects($this->once())
932
            ->method('get')
933
            ->with($this->identicalTo('_lug_status_code'), $this->identicalTo($defaultStatusCode = 200))
934
            ->will($this->returnValue($statusCode = 201));
935
936
        $this->assertSame($statusCode, $this->parameterResolver->resolveStatusCode($defaultStatusCode));
937
    }
938
939
    public function testResolveTemplate()
940
    {
941
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
942
            ->expects($this->exactly(2))
943
            ->method('getMasterRequest')
944
            ->will($this->returnValue($request = $this->createRequestMock()));
945
946
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
947
            ->expects($this->once())
948
            ->method('get')
949
            ->with($this->identicalTo('_lug_template'), $this->isNull())
950
            ->will($this->returnValue($template = 'template'));
951
952
        $this->assertSame($template, $this->parameterResolver->resolveTemplate());
953
    }
954
955
    /**
956
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RequestNotFoundException
957
     * @expectedExceptionMessage The request could not be found.
958
     */
959
    public function testResolveTemplateWithoutRequest()
960
    {
961
        $this->parameterResolver->resolveTemplate();
962
    }
963
964
    /**
965
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
966
     * @expectedExceptionMessage The template could not be found for the route "route".
967
     */
968 View Code Duplication
    public function testResolveTemplateMissing()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
969
    {
970
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
971
            ->expects($this->exactly(2))
972
            ->method('getMasterRequest')
973
            ->will($this->returnValue($request = $this->createRequestMock()));
974
975
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
976
            ->expects($this->at(0))
977
            ->method('get')
978
            ->with($this->identicalTo('_lug_template'), $this->isNull())
979
            ->will($this->returnValue(null));
980
981
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
982
            ->expects($this->at(1))
983
            ->method('get')
984
            ->with($this->identicalTo('_route'), $this->isNull())
985
            ->will($this->returnValue('route'));
986
987
        $this->parameterResolver->resolveTemplate();
988
    }
989
990
    public function testResolveThemesWithoutRequest()
991
    {
992
        $this->assertEmpty($this->parameterResolver->resolveThemes());
993
    }
994
995 View Code Duplication
    public function testResolveThemesDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
996
    {
997
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
998
            ->expects($this->once())
999
            ->method('getMasterRequest')
1000
            ->will($this->returnValue($request = $this->createRequestMock()));
1001
1002
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1003
            ->expects($this->once())
1004
            ->method('get')
1005
            ->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = []))
1006
            ->will($this->returnValue($themes));
1007
1008
        $this->assertEmpty($this->parameterResolver->resolveThemes());
1009
    }
1010
1011 View Code Duplication
    public function testResolveThemesExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1012
    {
1013
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1014
            ->expects($this->once())
1015
            ->method('getMasterRequest')
1016
            ->will($this->returnValue($request = $this->createRequestMock()));
1017
1018
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1019
            ->expects($this->once())
1020
            ->method('get')
1021
            ->with($this->identicalTo('_lug_themes'), $this->identicalTo([]))
1022
            ->will($this->returnValue($themes = ['theme']));
1023
1024
        $this->assertSame($themes, $this->parameterResolver->resolveThemes());
1025
    }
1026
1027
    public function testResolveTranslationDomainWithoutRequest()
1028
    {
1029
        $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain());
1030
    }
1031
1032 View Code Duplication
    public function testResolveTranslationDomainDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1033
    {
1034
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1035
            ->expects($this->exactly(2))
1036
            ->method('getMasterRequest')
1037
            ->will($this->returnValue($request = $this->createRequestMock()));
1038
1039
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1040
            ->expects($this->at(0))
1041
            ->method('get')
1042
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1043
            ->will($this->returnValue(null));
1044
1045
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1046
            ->expects($this->at(1))
1047
            ->method('get')
1048
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'forms'))
1049
            ->will($this->returnValue($translationDomain));
1050
1051
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1052
    }
1053
1054 View Code Duplication
    public function testResolveTranslationDomainExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1055
    {
1056
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1057
            ->expects($this->exactly(2))
1058
            ->method('getMasterRequest')
1059
            ->will($this->returnValue($request = $this->createRequestMock()));
1060
1061
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1062
            ->expects($this->at(0))
1063
            ->method('get')
1064
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1065
            ->will($this->returnValue(null));
1066
1067
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1068
            ->expects($this->at(1))
1069
            ->method('get')
1070
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms'))
1071
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1072
1073
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1074
    }
1075
1076 View Code Duplication
    public function testResolveTranslationDomainWithGrid()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1077
    {
1078
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1079
            ->expects($this->exactly(2))
1080
            ->method('getMasterRequest')
1081
            ->will($this->returnValue($request = $this->createRequestMock()));
1082
1083
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1084
            ->expects($this->at(0))
1085
            ->method('get')
1086
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1087
            ->will($this->returnValue(['grid']));
1088
1089
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1090
            ->expects($this->at(1))
1091
            ->method('get')
1092
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'grids'))
1093
            ->will($this->returnValue($translationDomain));
1094
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098 View Code Duplication
    public function testResolveTranslationDomainExplicitWithGrid()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1099
    {
1100
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1101
            ->expects($this->exactly(2))
1102
            ->method('getMasterRequest')
1103
            ->will($this->returnValue($request = $this->createRequestMock()));
1104
1105
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1106
            ->expects($this->at(0))
1107
            ->method('get')
1108
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1109
            ->will($this->returnValue(['grid']));
1110
1111
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1112
            ->expects($this->at(1))
1113
            ->method('get')
1114
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids'))
1115
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1116
1117
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1118
    }
1119
1120
    public function testResolveValidationGroupsWithoutRequest()
1121
    {
1122
        $this->assertEmpty($this->parameterResolver->resolveValidationGroups());
1123
    }
1124
1125 View Code Duplication
    public function testResolveValidationGroupsDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1126
    {
1127
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1128
            ->expects($this->once())
1129
            ->method('getMasterRequest')
1130
            ->will($this->returnValue($request = $this->createRequestMock()));
1131
1132
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1133
            ->expects($this->once())
1134
            ->method('get')
1135
            ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo($groups = []))
1136
            ->will($this->returnValue($groups));
1137
1138
        $this->assertEmpty($this->parameterResolver->resolveValidationGroups());
1139
    }
1140
1141 View Code Duplication
    public function testResolveValidationGroupsExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1142
    {
1143
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1144
            ->expects($this->once())
1145
            ->method('getMasterRequest')
1146
            ->will($this->returnValue($request = $this->createRequestMock()));
1147
1148
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1149
            ->expects($this->once())
1150
            ->method('get')
1151
            ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo([]))
1152
            ->will($this->returnValue($groups = ['group']));
1153
1154
        $this->assertSame($groups, $this->parameterResolver->resolveValidationGroups());
1155
    }
1156
1157
    public function testResolveVoterWithoutRequest()
1158
    {
1159
        $this->assertFalse($this->parameterResolver->resolveVoter());
1160
    }
1161
1162
    public function testResolveVoterDefault()
1163
    {
1164
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1165
            ->expects($this->once())
1166
            ->method('getMasterRequest')
1167
            ->will($this->returnValue($request = $this->createRequestMock()));
1168
1169
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1170
            ->expects($this->once())
1171
            ->method('get')
1172
            ->with($this->identicalTo('_lug_voter'), $this->identicalTo(false))
1173
            ->will($this->returnValue(false));
1174
1175
        $this->assertFalse($this->parameterResolver->resolveVoter());
1176
    }
1177
1178 View Code Duplication
    public function testResolveVoterExplicit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1179
    {
1180
        $this->requestStack
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\HttpFoundation\RequestStack.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
1181
            ->expects($this->once())
1182
            ->method('getMasterRequest')
1183
            ->will($this->returnValue($request = $this->createRequestMock()));
1184
1185
        $request->attributes
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1186
            ->expects($this->once())
1187
            ->method('get')
1188
            ->with($this->identicalTo('_lug_voter'), $this->identicalTo(false))
1189
            ->will($this->returnValue(true));
1190
1191
        $this->assertTrue($this->parameterResolver->resolveVoter());
1192
    }
1193
1194
    /**
1195
     * @return \PHPUnit_Framework_MockObject_MockObject|RequestStack
1196
     */
1197
    private function createRequestStackMock()
1198
    {
1199
        return $this->createMock(RequestStack::class);
1200
    }
1201
1202
    /**
1203
     * @return \PHPUnit_Framework_MockObject_MockObject|PropertyAccessorInterface
1204
     */
1205
    private function createPropertyAccessorMock()
1206
    {
1207
        return $this->createMock(PropertyAccessorInterface::class);
1208
    }
1209
1210
    /**
1211
     * @return \PHPUnit_Framework_MockObject_MockObject|Request
1212
     */
1213
    private function createRequestMock()
1214
    {
1215
        $request = $this->createMock(Request::class);
1216
        $request->attributes = $this->createParameterBagMock();
0 ignored issues
show
Bug introduced by
Accessing attributes on the interface PHPUnit_Framework_MockObject_MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
1217
1218
        return $request;
1219
    }
1220
1221
    /**
1222
     * @return \PHPUnit_Framework_MockObject_MockObject|ParameterBag
1223
     */
1224
    private function createParameterBagMock()
1225
    {
1226
        return $this->createMock(ParameterBag::class);
1227
    }
1228
1229
    /**
1230
     * @return \PHPUnit_Framework_MockObject_MockObject|ResourceInterface
1231
     */
1232
    private function createResourceMock()
1233
    {
1234
        return $this->createMock(ResourceInterface::class);
1235
    }
1236
}
1237