What is $null in canStartConversations in Visitor.php?

LPH

Well-known member
I'm just trying to dissect different parts of XenForo and figure out what is happening. While trying to see how classes were called and instantiated ... I ran across a $null in canStartConversations.

PHP:
    public function canStartConversations()
    {
        return XenForo_Model::create('XenForo_Model_User')->canStartConversations($null, $this->_user);
    }

phpStorm is showing that $null is undefined. In looking at the User.php in XenForo/Model ... there is

PHP:
public function canStartConversations(&$errorPhraseKey = '', array $viewingUser = null)

What is the $null doing at this point?
 
It essentially is just passing a variable into the function with the intention of never using it.
 
It essentially is just passing a variable into the function with the intention of never using it.

Does this mean the undefined $null (different from setting $null = NULL) is simply passed to the $errorPhraseKey? Is there a reason not to just state $errorPhraseKey = '' ? Or am I really lost on this? ;)
 
The notion of that is the value is set within the function and accessed globally. The $null setting just happens to stateit won't be used in that scope for readability.
 
  • Like
Reactions: LPH
Top Bottom