[#3513856]: Make UserSession::name protected
2 unresolved threads
Closes #3513856
Merge request reports
Activity
added 1 commit
- 124c1914 - Update FunctionalTestSetupTrait to use getAccountName
215 */ 216 public function __get($name): mixed { 217 if ($name === 'name') { 218 @trigger_error("Getting the name property is deprecated in drupal:11.2.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); 219 return $this->getAccountName(); 220 } 221 return $this->$name ?? NULL; 222 } 223 224 /** 225 * Implements magic __isset() method. 226 */ 227 public function __isset($name): bool { 228 if ($name === 'name') { 229 @trigger_error("Checking for the name property is deprecated in drupal:11.2.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); 230 return $this->getAccountName(); changed this line in version 5 of the diff
83 84 85 /** 86 * Tests the name property deprecation. 87 * 88 * @covers ::__get 89 * @covers ::__isset 90 */ 91 #[IgnoreDeprecations] 92 public function testNamePropertyDeprecation(): void { 93 $user = new UserSession([ 94 'name' => 'test', 95 ]); 96 $this->expectDeprecation('Getting the name property is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal\Core\Session\UserSession::getAccountName() instead. See https://www.drupal.org/node/3513856'); 97 self::assertEquals($user->name, $user->getAccountName()); 98 $this->expectDeprecation('Checking for the name property is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal\Core\Session\UserSession::getAccountName() instead. See https://www.drupal.org/node/3513856'); 99 $this->assertTrue(isset($user->name)); changed this line in version 6 of the diff
added 1 commit
- 3167a009 - Replace ::assertTrue instances with static calls
Please register or sign in to reply