Completed
Pull Request — master (#732)
by 12345
03:41
created

CacheManagerTest::testFallbackToDefaultResolver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 51
Code Lines 35

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 51
rs 9.4109
cc 1
eloc 35
nc 1
nop 0

How to fix   Long Method   

Long Method

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

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

Commonly applied refactorings include:

1
<?php
2
3
namespace Liip\ImagineBundle\Tests\Imagine\Cache;
4
5
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
6
use Liip\ImagineBundle\Model\Binary;
7
use Liip\ImagineBundle\Tests\AbstractTest;
8
use Liip\ImagineBundle\Imagine\Cache\Signer;
9
use Liip\ImagineBundle\ImagineEvents;
10
use Liip\ImagineBundle\Events\CacheResolveEvent;
11
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
12
13
/**
14
 * @covers Liip\ImagineBundle\Imagine\Cache\CacheManager
15
 */
16
class CacheManagerTest extends AbstractTest
17
{
18
    protected $resolver;
19
20
    public function testAddCacheManagerAwareResolver()
21
    {
22
        $cacheManager = new CacheManager($this->createFilterConfigurationMock(), $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
23
24
        $resolver = $this->getMock('Liip\ImagineBundle\Tests\Fixtures\CacheManagerAwareResolver');
25
        $resolver
26
            ->expects($this->once())
27
            ->method('setCacheManager')
28
            ->with($cacheManager)
29
        ;
30
31
        $cacheManager->addResolver('thumbnail', $resolver);
32
    }
33
34 View Code Duplication
    public function testGetBrowserPathWithoutResolver()
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...
35
    {
36
        $config = $this->createFilterConfigurationMock();
37
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
38
            ->expects($this->once())
39
            ->method('get')
40
            ->with('thumbnail')
41
            ->will($this->returnValue(array(
42
                'size' => array(180, 180),
43
                'mode' => 'outbound',
44
                'cache' => null,
45
            )))
46
        ;
47
48
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 36 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
49
50
        $this->setExpectedException('OutOfBoundsException', 'Could not find resolver "default" for "thumbnail" filter type');
51
        $cacheManager->getBrowserPath('cats.jpeg', 'thumbnail');
52
    }
53
54
    public function testGetRuntimePath()
55
    {
56
        $config = $this->createFilterConfigurationMock();
57
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 56 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
58
59
        $rcPath = $cacheManager->getRuntimePath('image.jpg', array(
60
            'thumbnail' => array(
61
                'size' => array(180, 180),
62
            ),
63
        ));
64
65
        $this->assertEquals('rc/ILfTutxX/image.jpg', $rcPath);
66
    }
67
68
    public function testDefaultResolverUsedIfNoneSetOnGetBrowserPath()
69
    {
70
        $resolver = $this->createResolverMock();
71
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
72
            ->expects($this->once())
73
            ->method('isStored')
74
            ->with('cats.jpeg', 'thumbnail')
75
            ->will($this->returnValue(true))
76
        ;
77
        $resolver
78
            ->expects($this->once())
79
            ->method('resolve')
80
            ->with('cats.jpeg', 'thumbnail')
81
            ->will($this->returnValue('http://a/path/to/an/image.png'))
82
        ;
83
84
        $config = $this->createFilterConfigurationMock();
85
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
86
            ->expects($this->exactly(2))
87
            ->method('get')
88
            ->with('thumbnail')
89
            ->will($this->returnValue(array(
90
                'size' => array(180, 180),
91
                'mode' => 'outbound',
92
                'cache' => null,
93
            )))
94
        ;
95
96
        $router = $this->createRouterMock();
97
        $router
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Routing\RouterInterface.

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...
98
            ->expects($this->never())
99
            ->method('generate')
100
        ;
101
102
        $cacheManager = new CacheManager($config, $router, new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 84 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
Bug introduced by
It seems like $router defined by $this->createRouterMock() on line 96 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
103
        $cacheManager->addResolver('default', $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 70 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
104
105
        $actualBrowserPath = $cacheManager->getBrowserPath('cats.jpeg', 'thumbnail');
106
107
        $this->assertEquals('http://a/path/to/an/image.png', $actualBrowserPath);
108
    }
109
110
    public function testFilterActionUrlGeneratedAndReturnIfResolverReturnNullOnGetBrowserPath()
111
    {
112
        $resolver = $this->createResolverMock();
113
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
114
            ->expects($this->once())
115
            ->method('isStored')
116
            ->with('cats.jpeg', 'thumbnail')
117
            ->will($this->returnValue(false))
118
        ;
119
        $resolver
120
            ->expects($this->never())
121
            ->method('resolve')
122
        ;
123
124
        $config = $this->createFilterConfigurationMock();
125
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
126
            ->expects($this->atLeastOnce())
127
            ->method('get')
128
            ->with('thumbnail')
129
            ->will($this->returnValue(array(
130
                'size' => array(180, 180),
131
                'mode' => 'outbound',
132
                'cache' => null,
133
            )))
134
        ;
135
136
        $router = $this->createRouterMock();
137
        $router
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Routing\RouterInterface.

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...
138
            ->expects($this->once())
139
            ->method('generate')
140
            ->will($this->returnValue('/media/cache/thumbnail/cats.jpeg'))
141
        ;
142
143
        $cacheManager = new CacheManager($config, $router, new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 124 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
Bug introduced by
It seems like $router defined by $this->createRouterMock() on line 136 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
144
        $cacheManager->addResolver('default', $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 112 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
145
146
        $actualBrowserPath = $cacheManager->getBrowserPath('cats.jpeg', 'thumbnail');
147
148
        $this->assertEquals('/media/cache/thumbnail/cats.jpeg', $actualBrowserPath);
149
    }
150
151
    public function testFilterActionUrlGeneratedAndReturnIfResolverReturnNullOnGetBrowserPathWithRuntimeConfig()
152
    {
153
        $runtimeConfig = array(
154
            'thumbnail' => array(
155
                'size' => array(100, 100),
156
            ),
157
        );
158
159
        $resolver = $this->createResolverMock();
160
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
161
            ->expects($this->once())
162
            ->method('isStored')
163
            ->with('rc/VhOzTGRB/cats.jpeg', 'thumbnail')
164
            ->will($this->returnValue(false))
165
        ;
166
        $resolver
167
            ->expects($this->never())
168
            ->method('resolve')
169
        ;
170
171
        $config = $this->createFilterConfigurationMock();
172
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
173
            ->expects($this->atLeastOnce())
174
            ->method('get')
175
            ->with('thumbnail')
176
            ->will($this->returnValue(array(
177
                'size' => array(180, 180),
178
                'mode' => 'outbound',
179
                'cache' => null,
180
            )))
181
        ;
182
183
        $router = $this->createRouterMock();
184
        $router
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Routing\RouterInterface.

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...
185
            ->expects($this->once())
186
            ->method('generate')
187
            ->will($this->returnValue('/media/cache/thumbnail/rc/VhOzTGRB/cats.jpeg'))
188
        ;
189
190
        $cacheManager = new CacheManager($config, $router, new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 171 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
Bug introduced by
It seems like $router defined by $this->createRouterMock() on line 183 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
191
        $cacheManager->addResolver('default', $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 159 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
192
193
        $actualBrowserPath = $cacheManager->getBrowserPath('cats.jpeg', 'thumbnail', $runtimeConfig);
194
195
        $this->assertEquals('/media/cache/thumbnail/rc/VhOzTGRB/cats.jpeg', $actualBrowserPath);
196
    }
197
198
    /**
199
     * @dataProvider invalidPathProvider
200
     */
201 View Code Duplication
    public function testResolveInvalidPath($path)
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...
202
    {
203
        $cacheManager = new CacheManager(
204
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
205
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
206
            new Signer('secret'),
207
            $this->createEventDispatcherMock()
208
        );
209
210
        $this->setExpectedException('Symfony\Component\HttpKernel\Exception\NotFoundHttpException');
211
        $cacheManager->resolve($path, 'thumbnail');
212
    }
213
214 View Code Duplication
    public function testThrowsIfConcreteResolverNotExists()
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...
215
    {
216
        $cacheManager = new CacheManager(
217
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
218
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
219
            new Signer('secret'),
220
            $this->createEventDispatcherMock()
221
        );
222
223
        $this->setExpectedException('OutOfBoundsException', 'Could not find resolver "default" for "thumbnail" filter type');
224
        $this->assertFalse($cacheManager->resolve('cats.jpeg', 'thumbnail'));
225
    }
226
227
    public function testFallbackToDefaultResolver()
228
    {
229
        $binary = new Binary('aContent', 'image/png', 'png');
230
231
        $resolver = $this->createResolverMock();
232
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
233
            ->expects($this->once())
234
            ->method('resolve')
235
            ->with('cats.jpeg', 'thumbnail')
236
            ->will($this->returnValue('/thumbs/cats.jpeg'))
237
        ;
238
        $resolver
239
            ->expects($this->once())
240
            ->method('store')
241
            ->with($binary, '/thumbs/cats.jpeg', 'thumbnail')
242
        ;
243
        $resolver
244
            ->expects($this->once())
245
            ->method('remove')
246
            ->with(array('/thumbs/cats.jpeg'), array('thumbnail'))
247
            ->will($this->returnValue(true))
248
        ;
249
250
        $config = $this->createFilterConfigurationMock();
251
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
252
            ->expects($this->exactly(3))
253
            ->method('get')
254
            ->with('thumbnail')
255
            ->will($this->returnValue(array(
256
                'size' => array(180, 180),
257
                'mode' => 'outbound',
258
                'cache' => null,
259
            )))
260
        ;
261
262
        $cacheManager = new CacheManager(
263
            $config,
0 ignored issues
show
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 250 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
264
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
265
            new Signer('secret'),
266
            $this->createEventDispatcherMock()
267
        );
268
        $cacheManager->addResolver('default', $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 231 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
269
270
        // Resolve fallback to default resolver
271
        $this->assertEquals('/thumbs/cats.jpeg', $cacheManager->resolve('cats.jpeg', 'thumbnail'));
272
273
        $cacheManager->store($binary, '/thumbs/cats.jpeg', 'thumbnail');
274
275
        // Remove fallback to default resolver
276
        $cacheManager->remove('/thumbs/cats.jpeg', 'thumbnail');
277
    }
278
279
    public function testGenerateUrl()
280
    {
281
        $path = 'thePath';
282
        $expectedUrl = 'theUrl';
283
284
        $routerMock = $this->createRouterMock();
285
        $routerMock
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Routing\RouterInterface.

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...
286
            ->expects($this->once())
287
            ->method('generate')
288
            ->with(
289
                'liip_imagine_filter',
290
                array(
291
                    'path' => $path,
292
                    'filter' => 'thumbnail',
293
                ),
294
                UrlGeneratorInterface::ABSOLUTE_URL
295
            )
296
            ->will($this->returnValue($expectedUrl))
297
        ;
298
299
        $cacheManager = new CacheManager(
300
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
301
            $routerMock,
0 ignored issues
show
Bug introduced by
It seems like $routerMock defined by $this->createRouterMock() on line 284 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
302
            new Signer('secret'),
303
            $this->createEventDispatcherMock()
304
        );
305
306
        $this->assertEquals(
307
            $expectedUrl,
308
            $cacheManager->generateUrl($path, 'thumbnail')
309
        );
310
    }
311
312
    public function testRemoveCacheForPathAndFilterOnRemove()
313
    {
314
        $expectedPath = 'thePath';
315
        $expectedFilter = 'theFilter';
316
317
        $resolver = $this->createResolverMock();
318
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
319
            ->expects($this->once())
320
            ->method('remove')
321
            ->with(array($expectedPath), array($expectedFilter))
322
        ;
323
324
        $config = $this->createFilterConfigurationMock();
325
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
326
            ->expects($this->atLeastOnce())
327
            ->method('get')
328
            ->will($this->returnCallback(function ($filter) {
329
                return array(
330
                    'cache' => $filter,
331
                );
332
            }))
333
        ;
334
335
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 324 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
336
        $cacheManager->addResolver($expectedFilter, $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 317 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
337
338
        $cacheManager->remove($expectedPath, $expectedFilter);
339
    }
340
341
    public function testRemoveCacheForPathAndSomeFiltersOnRemove()
342
    {
343
        $expectedPath = 'thePath';
344
        $expectedFilterOne = 'theFilterOne';
345
        $expectedFilterTwo = 'theFilterTwo';
346
347
        $resolverOne = $this->createResolverMock();
348
        $resolverOne
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
349
            ->expects($this->once())
350
            ->method('remove')
351
            ->with(array($expectedPath), array($expectedFilterOne))
352
        ;
353
354
        $resolverTwo = $this->createResolverMock();
355
        $resolverTwo
356
            ->expects($this->once())
357
            ->method('remove')
358
            ->with(array($expectedPath), array($expectedFilterTwo))
359
        ;
360
361
        $config = $this->createFilterConfigurationMock();
362
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
363
            ->expects($this->atLeastOnce())
364
            ->method('get')
365
            ->will($this->returnCallback(function ($filter) {
366
                return array(
367
                    'cache' => $filter,
368
                );
369
            }))
370
        ;
371
372
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 361 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
373
        $cacheManager->addResolver($expectedFilterOne, $resolverOne);
0 ignored issues
show
Bug introduced by
It seems like $resolverOne defined by $this->createResolverMock() on line 347 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
374
        $cacheManager->addResolver($expectedFilterTwo, $resolverTwo);
0 ignored issues
show
Bug introduced by
It seems like $resolverTwo defined by $this->createResolverMock() on line 354 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
375
376
        $cacheManager->remove($expectedPath, array($expectedFilterOne, $expectedFilterTwo));
377
    }
378
379 View Code Duplication
    public function testRemoveCacheForSomePathsAndFilterOnRemove()
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...
380
    {
381
        $expectedPathOne = 'thePathOne';
382
        $expectedPathTwo = 'thePathTwo';
383
        $expectedFilter = 'theFilter';
384
385
        $resolver = $this->createResolverMock();
386
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
387
            ->expects($this->once())
388
            ->method('remove')
389
            ->with(
390
                array($expectedPathOne, $expectedPathTwo),
391
                array($expectedFilter)
392
            )
393
        ;
394
395
        $config = $this->createFilterConfigurationMock();
396
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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->atLeastOnce())
398
            ->method('get')
399
            ->will($this->returnCallback(function ($filter) {
400
                return array(
401
                    'cache' => $filter,
402
                );
403
            }))
404
        ;
405
406
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 395 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
407
        $cacheManager->addResolver($expectedFilter, $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 385 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
408
409
        $cacheManager->remove(array($expectedPathOne, $expectedPathTwo), $expectedFilter);
410
    }
411
412
    public function testRemoveCacheForSomePathsAndSomeFiltersOnRemove()
413
    {
414
        $expectedPathOne = 'thePath';
415
        $expectedPathTwo = 'thePath';
416
        $expectedFilterOne = 'theFilterOne';
417
        $expectedFilterTwo = 'theFilterTwo';
418
419
        $resolverOne = $this->createResolverMock();
420
        $resolverOne
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
421
            ->expects($this->once())
422
            ->method('remove')
423
            ->with(array($expectedPathOne, $expectedPathTwo), array($expectedFilterOne))
424
        ;
425
426
        $resolverTwo = $this->createResolverMock();
427
        $resolverTwo
428
            ->expects($this->once())
429
            ->method('remove')
430
            ->with(array($expectedPathOne, $expectedPathTwo), array($expectedFilterTwo))
431
        ;
432
433
        $config = $this->createFilterConfigurationMock();
434
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
435
            ->expects($this->atLeastOnce())
436
            ->method('get')
437
            ->will($this->returnCallback(function ($filter) {
438
                return array(
439
                    'cache' => $filter,
440
                );
441
            }))
442
        ;
443
444
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 433 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
445
        $cacheManager->addResolver($expectedFilterOne, $resolverOne);
0 ignored issues
show
Bug introduced by
It seems like $resolverOne defined by $this->createResolverMock() on line 419 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
446
        $cacheManager->addResolver($expectedFilterTwo, $resolverTwo);
0 ignored issues
show
Bug introduced by
It seems like $resolverTwo defined by $this->createResolverMock() on line 426 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
447
448
        $cacheManager->remove(
449
            array($expectedPathOne, $expectedPathTwo),
450
            array($expectedFilterOne, $expectedFilterTwo)
451
        );
452
    }
453
454
    public function testRemoveCacheForAllFiltersOnRemove()
455
    {
456
        $expectedFilterOne = 'theFilterOne';
457
        $expectedFilterTwo = 'theFilterTwo';
458
459
        $resolverOne = $this->createResolverMock();
460
        $resolverOne
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
461
            ->expects($this->once())
462
            ->method('remove')
463
            ->with(array(), array($expectedFilterOne))
464
        ;
465
466
        $resolverTwo = $this->createResolverMock();
467
        $resolverTwo
468
            ->expects($this->once())
469
            ->method('remove')
470
            ->with(array(), array($expectedFilterTwo))
471
        ;
472
473
        $config = $this->createFilterConfigurationMock();
474
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
475
            ->expects($this->atLeastOnce())
476
            ->method('get')
477
            ->will($this->returnCallback(function ($filter) {
478
                return array(
479
                    'cache' => $filter,
480
                );
481
            }))
482
        ;
483
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
484
            ->expects($this->once())
485
            ->method('all')
486
            ->will($this->returnValue(array(
487
                $expectedFilterOne => array(),
488
                $expectedFilterTwo => array(),
489
            )))
490
        ;
491
492
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 473 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
493
        $cacheManager->addResolver($expectedFilterOne, $resolverOne);
0 ignored issues
show
Bug introduced by
It seems like $resolverOne defined by $this->createResolverMock() on line 459 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
494
        $cacheManager->addResolver($expectedFilterTwo, $resolverTwo);
0 ignored issues
show
Bug introduced by
It seems like $resolverTwo defined by $this->createResolverMock() on line 466 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
495
496
        $cacheManager->remove();
497
    }
498
499
    public function testRemoveCacheForPathAndAllFiltersOnRemove()
500
    {
501
        $expectedFilterOne = 'theFilterOne';
502
        $expectedFilterTwo = 'theFilterTwo';
503
        $expectedPath = 'thePath';
504
505
        $resolverOne = $this->createResolverMock();
506
        $resolverOne
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
507
            ->expects($this->once())
508
            ->method('remove')
509
            ->with(array($expectedPath), array($expectedFilterOne))
510
        ;
511
512
        $resolverTwo = $this->createResolverMock();
513
        $resolverTwo
514
            ->expects($this->once())
515
            ->method('remove')
516
            ->with(array($expectedPath), array($expectedFilterTwo))
517
        ;
518
519
        $config = $this->createFilterConfigurationMock();
520
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
521
            ->expects($this->atLeastOnce())
522
            ->method('get')
523
            ->will($this->returnCallback(function ($filter) {
524
                return array(
525
                    'cache' => $filter,
526
                );
527
            }))
528
        ;
529
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
530
            ->expects($this->once())
531
            ->method('all')
532
            ->will($this->returnValue(array(
533
                $expectedFilterOne => array(),
534
                $expectedFilterTwo => array(),
535
            )))
536
        ;
537
538
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 519 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
539
        $cacheManager->addResolver($expectedFilterOne, $resolverOne);
0 ignored issues
show
Bug introduced by
It seems like $resolverOne defined by $this->createResolverMock() on line 505 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
540
        $cacheManager->addResolver($expectedFilterTwo, $resolverTwo);
0 ignored issues
show
Bug introduced by
It seems like $resolverTwo defined by $this->createResolverMock() on line 512 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
541
542
        $cacheManager->remove($expectedPath);
543
    }
544
545 View Code Duplication
    public function testAggregateFiltersByResolverOnRemove()
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...
546
    {
547
        $expectedFilterOne = 'theFilterOne';
548
        $expectedFilterTwo = 'theFilterTwo';
549
550
        $resolver = $this->createResolverMock();
551
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
552
            ->expects($this->once())
553
            ->method('remove')
554
            ->with(array(), array($expectedFilterOne, $expectedFilterTwo))
555
        ;
556
557
        $config = $this->createFilterConfigurationMock();
558
        $config
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...ter\FilterConfiguration.

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...
559
            ->expects($this->atLeastOnce())
560
            ->method('get')
561
            ->will($this->returnCallback(function ($filter) {
562
                return array(
563
                    'cache' => $filter,
564
                );
565
            }))
566
        ;
567
568
        $cacheManager = new CacheManager($config, $this->createRouterMock(), new Signer('secret'), $this->createEventDispatcherMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $config defined by $this->createFilterConfigurationMock() on line 557 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
569
        $cacheManager->addResolver($expectedFilterOne, $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 550 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
570
        $cacheManager->addResolver($expectedFilterTwo, $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 550 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
571
572
        $cacheManager->remove(null, array($expectedFilterOne, $expectedFilterTwo));
573
    }
574
575 View Code Duplication
    public function testShouldDispatchCachePreResolveEvent()
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...
576
    {
577
        $dispatcher = $this->createEventDispatcherMock();
578
        $dispatcher
579
            ->expects($this->at(0))
580
            ->method('dispatch')
581
            ->with(ImagineEvents::PRE_RESOLVE, new CacheResolveEvent('cats.jpg', 'thumbnail'))
582
        ;
583
584
        $cacheManager = new CacheManager(
585
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
586
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
587
            new Signer('secret'),
588
            $dispatcher
589
        );
590
        $cacheManager->addResolver('default', $this->createResolverMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createResolverMock() targeting Liip\ImagineBundle\Tests...t::createResolverMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
591
592
        $cacheManager->resolve('cats.jpg', 'thumbnail');
593
    }
594
595 View Code Duplication
    public function testShouldDispatchCachePostResolveEvent()
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...
596
    {
597
        $dispatcher = $this->createEventDispatcherMock();
598
        $dispatcher
599
            ->expects($this->at(1))
600
            ->method('dispatch')
601
            ->with(ImagineEvents::POST_RESOLVE, new CacheResolveEvent('cats.jpg', 'thumbnail'))
602
        ;
603
604
        $cacheManager = new CacheManager(
605
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
606
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
607
            new Signer('secret'),
608
            $dispatcher
609
        );
610
        $cacheManager->addResolver('default', $this->createResolverMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createResolverMock() targeting Liip\ImagineBundle\Tests...t::createResolverMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
611
612
        $cacheManager->resolve('cats.jpg', 'thumbnail');
613
    }
614
615
    public function testShouldAllowToPassChangedDataFromPreResolveEventToResolver()
616
    {
617
        $dispatcher = $this->createEventDispatcherMock();
618
        $dispatcher
619
            ->expects($this->at(0))
620
            ->method('dispatch')
621
            ->with(ImagineEvents::PRE_RESOLVE, $this->isInstanceOf('Liip\ImagineBundle\Events\CacheResolveEvent'))
622
            ->will($this->returnCallback(function ($name, $event) {
623
                $event->setPath('changed_path');
624
                $event->setFilter('changed_filter');
625
            }))
626
        ;
627
628
        $resolver = $this->createResolverMock();
629
        $resolver
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Liip\ImagineBundle\Imagi...olver\ResolverInterface.

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...
630
            ->expects($this->once())
631
            ->method('resolve')
632
            ->with('changed_path', 'changed_filter')
633
        ;
634
635
        $cacheManager = new CacheManager(
636
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
637
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
638
            new Signer('secret'),
639
            $dispatcher
640
        );
641
        $cacheManager->addResolver('default', $resolver);
0 ignored issues
show
Bug introduced by
It seems like $resolver defined by $this->createResolverMock() on line 628 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
642
643
        $cacheManager->resolve('cats.jpg', 'thumbnail');
644
    }
645
646
    public function testShouldAllowToGetResolverByFilterChangedInPreResolveEvent()
647
    {
648
        $dispatcher = $this->createEventDispatcherMock();
649
        $dispatcher
650
            ->expects($this->at(0))
651
            ->method('dispatch')
652
            ->will($this->returnCallback(function ($name, $event) {
653
                $event->setFilter('thumbnail');
654
            }))
655
        ;
656
657
        $cacheManager = $this->getMock('Liip\ImagineBundle\Imagine\Cache\CacheManager', array('getResolver'), array(
658
            $this->createFilterConfigurationMock(),
659
            $this->createRouterMock(),
660
            new Signer('secret'),
661
            $dispatcher,
662
        ));
663
664
        $cacheManager
665
            ->expects($this->once())
666
            ->method('getResolver')
667
            ->with('thumbnail')
668
            ->will($this->returnValue($this->createResolverMock()))
669
        ;
670
671
        $cacheManager->resolve('cats.jpg', 'default');
672
    }
673
674
    public function testShouldAllowToPassChangedDataFromPreResolveEventToPostResolveEvent()
675
    {
676
        $dispatcher = $this->createEventDispatcherMock();
677
        $dispatcher
678
            ->expects($this->at(0))
679
            ->method('dispatch')
680
            ->with(ImagineEvents::PRE_RESOLVE, $this->isInstanceOf('Liip\ImagineBundle\Events\CacheResolveEvent'))
681
            ->will($this->returnCallback(function ($name, $event) {
682
                $event->setPath('changed_path');
683
                $event->setFilter('changed_filter');
684
            }))
685
        ;
686
687
        $dispatcher
688
            ->expects($this->at(1))
689
            ->method('dispatch')
690
            ->with(
691
                ImagineEvents::POST_RESOLVE,
692
                $this->logicalAnd(
693
                    $this->isInstanceOf('Liip\ImagineBundle\Events\CacheResolveEvent'),
694
                    $this->attributeEqualTo('path', 'changed_path'),
695
                    $this->attributeEqualTo('filter', 'changed_filter')
696
            ))
697
        ;
698
699
        $cacheManager = new CacheManager(
700
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
701
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
702
            new Signer('secret'),
703
            $dispatcher
704
        );
705
        $cacheManager->addResolver('default', $this->createResolverMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createResolverMock() targeting Liip\ImagineBundle\Tests...t::createResolverMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
706
707
        $cacheManager->resolve('cats.jpg', 'thumbnail');
708
    }
709
710
    public function testShouldReturnUrlChangedInPostResolveEvent()
711
    {
712
        $dispatcher = $this->createEventDispatcherMock();
713
        $dispatcher
714
            ->expects($this->at(1))
715
            ->method('dispatch')
716
            ->with(ImagineEvents::POST_RESOLVE, $this->isInstanceOf('Liip\ImagineBundle\Events\CacheResolveEvent'))
717
            ->will($this->returnCallback(function ($name, $event) {
718
                $event->setUrl('changed_url');
719
            }))
720
        ;
721
722
        $cacheManager = new CacheManager(
723
            $this->createFilterConfigurationMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createFilterConfigurationMock() targeting Liip\ImagineBundle\Tests...lterConfigurationMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Liip\ImagineBundl...er\FilterConfiguration>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
724
            $this->createRouterMock(),
0 ignored issues
show
Bug introduced by
It seems like $this->createRouterMock() targeting Liip\ImagineBundle\Tests...est::createRouterMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::__construct() does only seem to accept object<Symfony\Component\Routing\RouterInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
725
            new Signer('secret'),
726
            $dispatcher
727
        );
728
        $cacheManager->addResolver('default', $this->createResolverMock());
0 ignored issues
show
Bug introduced by
It seems like $this->createResolverMock() targeting Liip\ImagineBundle\Tests...t::createResolverMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Liip\ImagineBundle\Imagi...eManager::addResolver() does only seem to accept object<Liip\ImagineBundl...lver\ResolverInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
729
730
        $url = $cacheManager->resolve('cats.jpg', 'thumbnail');
731
732
        $this->assertEquals('changed_url', $url);
733
    }
734
}
735