Due to PHP Bug #53727, is_subclass_of might return inconsistent results on some PHP versions if \Symfony\Contracts\Event...patcherInterface::class can be an interface. If so, you could instead use ReflectionClass::implementsInterface.
The type Liip\ImagineBundle\Events\BCEvent has been defined more than once; this definition is ignored, only the first definition in this file (L20-22) is considered.
This check looks for classes that have been defined more than once in the same file.
If you can, we would recommend to use standard object-oriented programming
techniques. For example, to avoid multiple types, it might make sense to create a
common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion,
static analysis and also better OPCode caching from PHP.
Loading history...
25
{
26
}
27
}
28
29
class CacheResolveEvent extends BCEvent
30
{
31
/**
32
* Resource path.
33
*
34
* @var string
35
*/
36
protected $path;
37
38
/**
39
* Filter name.
40
*
41
* @var string
42
*/
43
protected $filter;
44
45
/**
46
* Resource url.
47
*
48
* @var null
49
*/
50
protected $url;
51
52
/**
53
* Init default event state.
54
*
55
* @param string $path
56
* @param string $filter
57
* @param string|null $url
58
*/
59
public function __construct($path, $filter, $url = null)
It seems like $url can also be of type string. However, the property $url is declared as type null. Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property.
This check raises an issue when a value that can be of a mixed type is assigned to
a property that is type hinted more strictly.
For example, imagine you have a variable $accountId that can either hold an
Id object or false (if there is no account id yet). Your code now assigns that
value to the id property of an instance of the Account class. This class
holds a proper account, so the id value must no longer be false.
Either this assignment is in error or a type check should be added for that assignment.
classId{public$id;publicfunction__construct($id){$this->id=$id;}}classAccount{/** @var Id $id */public$id;}$account_id=false;if(starsAreRight()){$account_id=newId(42);}$account=newAccount();if($accountinstanceofId){$account->id=$account_id;}