It seems like $this->cmb->mb_object_type() can also be of type false. However, the property $object_type is declared as type string. 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;}
Loading history...
36
}
37
38
abstract public function universal_hooks();
39
40
/**
41
* Ensures WordPress hook only gets fired once per object.
42
* @since 2.0.0
43
* @param string $action The name of the filter to hook the $hook callback to.
44
* @param callback $hook The callback to be run when the filter is applied.
45
* @param integer $priority Order the functions are executed
46
* @param int $accepted_args The number of arguments the function accepts.
47
*/
48
public function once( $action, $hook, $priority = 10, $accepted_args = 1 ) {
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.