function UserSession::__isset

Implements magic __isset() method.

File

core/lib/Drupal/Core/Session/UserSession.php, line 232

Class

UserSession
An implementation of the user account interface for the global user.

Namespace

Drupal\Core\Session

Code

public function __isset($name) : bool {
  if ($name === 'name') {
    @trigger_error("Checking for the name property is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Use \\Drupal\\Core\\Session\\UserSession::getAccountName() instead. See https://www.drupal.org/node/3513856", E_USER_DEPRECATED);
    return isset($this->name);
  }
  $class = get_class($this);
  $properties = get_class_vars($class);
  if (\array_key_exists($name, $properties)) {
    throw new \LogicException("Cannot access protected property {$name} in " . $class);
  }
  return isset($this->{$name});
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.