Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296506

Improve LoggedInUser's annotation

$
0
0

I was running a lint check on the examples module (see contrib) and IDE was picking up lots of warnings related to loggedInUser.

Making this small change removed 19 errors/warnings. ( 2% of total )

Looking at my IDE's report of the uses of $loggedInUser it is both variable I would want to be called $isUserLoggedIn and a \Drupal\Core\Session\AccountInterface object.

There is nothing particularly wrong with this design choice...

Writes to loggedInUser

WebTestBase::drupalLogin()
$this->loggedInUser = $account; // $account is of type \Drupal\Core\Session\AccountInterface;

WebTestBase::drupalLogout()
$this->loggedInUser = FALSE;

Read from loggedInUser

SimpleTestExampleTest::testSimeplTestExampleCreate()
reads $this->loggedInUser->getUsername(),

RouterTest::testUserAccount()
reads $this->loggedInUser->id()


Viewing all articles
Browse latest Browse all 296506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>