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
Comment #2
cilefen commentedI use the same IDE and the IDE is actually wrong here. It doesn't "know" that
$accountis "really" an AccountInterface because$account = $this->userStorage->load(1);returns a generic EntityInterface, so the IDE is for some reason guessing that$accountis a FilterFormat. Furthermore because$accountis an entity it is to a certain degree a value object that allows setting dynamic properties because that's how the API works.Comment #3
extexan commented@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.