@trigger_error("Getting 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$this->getAccountName();
}
$class=get_class($this);
$properties=get_class_vars($class);
if(\array_key_exists($name,$properties)){
thrownew\LogicException("Cannot access protected property $name in ".$class);
}
return$this->$name??NULL;
}
/**
* Implements magic __isset() method.
*/
publicfunction__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);
returnisset($this->name);
}
$class=get_class($this);
$properties=get_class_vars($class);
if(\array_key_exists($name,$properties)){
thrownew\LogicException("Cannot access protected property $name in ".$class);
}
returnisset($this->$name);
}
/**
* Implements magic __set() method.
*/
publicfunction__set($name,$value):void{
if($name==='name'){
@trigger_error("Setting the name property is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Set the name via the constructor when creating the UserSession instance. See https://www.drupal.org/node/3513856",E_USER_DEPRECATED);
$this->name=$value;
return;
}
$class=get_class($this);
$properties=get_class_vars($class);
if(\array_key_exists($name,$properties)){
thrownew\LogicException("Cannot set protected property $name in ".$class);
$this->expectDeprecation('Getting 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');
$this->expectDeprecation('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');
self::assertTrue(isset($user->name));
// Test setting the name property.
$this->expectDeprecation('Setting the name property is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Set the name via the constructor when creating the UserSession instance. See https://www.drupal.org/node/3513856');