WidgetCacheClearer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Victoire\Bundle\WidgetBundle\Cache;
4
5
use Predis\Client;
6
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
7
use Victoire\Bundle\WidgetBundle\Entity\Widget;
8
9
/**
10
 * This class handle the saving of Widgets.
11
 * Widgets are stored for a week, but are invalidated as soon as
12
 * the Widget's or BusinessEntity's updatedAt field is changed.
13
 */
14
class WidgetCacheClearer implements CacheClearerInterface
15
{
16
    /**
17
     * @var Client
18
     */
19
    private $cache;
20
21
    /**
22
     * WidgetCache constructor.
23
     *
24
     * @param Client $cache
25
     */
26
    public function __construct(WidgetCache $cache)
27
    {
28
        $this->cache = $cache;
0 ignored issues
show
Documentation Bug introduced by
It seems like $cache of type object<Victoire\Bundle\W...ndle\Cache\WidgetCache> is incompatible with the declared type object<Predis\Client> of property $cache.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
29
    }
30
31
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$cacheDir" missing
Loading history...
32
     * @param Widget $widget
0 ignored issues
show
Bug introduced by
There is no parameter named $widget. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
introduced by
Doc comment for parameter $widget does not match actual variable name $cacheDir
Loading history...
33
     *
34
     * @return string
35
     */
36
    public function clear($cacheDir)
37
    {
38
        $this->cache->clear();
39
    }
40
}
41