I haven't actually had an issue with this (yet), as I have not needed to install a D8 site from scratch. But I just updated to D8.8 and my IDE is now complaining about this. Line 310 of core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php is:

    $account->roles = $account->getRoles();

My IDE is complaining about the "roles" property, saying "Member has protected access". I got lost tracing back through the various classes, but I did notice in UserStorageInterface (of which the above $account var is an instance), two of the function declarations are as follows:

  public function updateLastLoginTimestamp(UserInterface $account);
  public function updateLastAccessTimestamp(AccountInterface $account, $timestamp);

So one declares $account as UserInterface, and the other declares it as AccountInterface. I'm not sure why that is, just pointing it out in case it's an oversight (and/or possibly the cause of this issue).

Comments

ExTexan created an issue. See original summary.

cilefen’s picture

Version: 8.8.x-dev » 8.9.x-dev
Component: configuration system » user system

I use the same IDE and the IDE is actually wrong here. It doesn't "know" that $account is "really" an AccountInterface because $account = $this->userStorage->load(1); returns a generic EntityInterface, so the IDE is for some reason guessing that $account is a FilterFormat. Furthermore because $account is an entity it is to a certain degree a value object that allows setting dynamic properties because that's how the API works.

extexan’s picture

Status: Active » Closed (works as designed)

@cilefen, Thanks for the quick reply, and for clearing that up. I've seen warnings from Intellij IDEA that I just have to remember to ignore, but this is the first one that was flagged as a fatal PHP error. It's really annoying to have those red squiggly lines all through my folder tree.

Cheers and Happy New Year.