Skip to content

Commit

Permalink
Fix userid handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl authored Oct 8, 2024
1 parent b7a7769 commit 4e8a28f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions MatomoTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class MatomoTracker
public $configReferralCookieTimeout = 15768000; // 6 months

// Visitor Ids in order
public $userId = false;
public $userId = null;

public $forcedVisitorId = false;

Expand Down Expand Up @@ -1571,11 +1571,11 @@ public function setIp(string $ip)
*
* A User ID can be a username, UUID or an email address, or any number or string that uniquely identifies a user or client.
*
* @param string $userId Any user ID string (eg. email address, ID, username). Must be non empty. Set to false to de-assign a user id previously set.
* @param string|null $userId Any user ID string (eg. email address, ID, username). Must be non empty. Set to null to de-assign a user id previously set.
* @return $this
* @throws Exception
*/
public function setUserId(string $userId)
public function setUserId(?string $userId)
{
if ($userId === '') {
throw new Exception("User ID cannot be empty.");
Expand Down Expand Up @@ -1674,9 +1674,9 @@ public function getIp()
* Returns the User ID string, which may have been set via:
* $v->setUserId('[email protected]');
*
* @return bool
* @return string|null
*/
public function getUserId()
public function getUserId(): ?string
{
return $this->userId;
}
Expand Down

0 comments on commit 4e8a28f

Please sign in to comment.