It seems like $user defined by parameter $user on line 37 can be null; however, Eziat\PermissionBundle\M...t::getUserPermissions() does not accept null, maybe add an additional type check?
It seems like you allow that null is being passed for a parameter, however the
function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):
functionnotNullable(stdClass$x){}// UnsafefunctionwithoutCheck(stdClass$x=null){notNullable($x);}// Safe - Alternative 1: Adding Additional Type-CheckfunctionwithCheck(stdClass$x=null){if($xinstanceofstdClass){notNullable($x);}}// Safe - Alternative 2: Changing ParameterfunctionwithNonNullableParam(stdClass$x){notNullable($x);}
Loading history...
43
if ( $permissions !== [] ){
44
$this->cacheHelper->save($cacheID, $permissions);
45
}
46
}
47
48
return $permissions;
49
}
50
51
/**
52
* {@inheritdoc}
53
*/
54
public function invalidatePermissions(UserPermissionInterface $user) : void
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: