Files
piratepoet/mailpoet/tests/integration/Segments/WPTestUser.php
Brezo Cordero 4cd3c4ed77 Remove PHPStan level 6 errors from Segments
Remove the following errors:
(Method|Property|Function) has no (return )?type specified.
(Method|Function) has parameter with no type (specified).

[MAILPOET-3720]
2022-05-23 12:04:12 +02:00

27 lines
669 B
PHP

<?php
namespace MailPoet\Test\Segments;
class WPTestUser extends \WP_User {
/** @var int */
public $orderId;
/**
* The native \WP_User::add_role() method contains the 'add_role' hook, which triggers
* MailPoet to synchronize the user. Therefore, we overwrite the method here
* for cases, where we do not want to trigger the synchronization but just want to
* assign a role to a user.
*/
public function add_role($role): void
{
if (empty($role)) {
return;
}
$this->caps[$role] = true;
update_user_meta($this->ID, $this->cap_key, $this->caps);
$this->get_role_caps();
$this->update_user_level_from_caps();
}
}