Problem/Motivation
Depending on the state of the field, and which methods have been called, the return value of getValue()
will be different.
Scenario
$field = User::load(1)->get('pass');
$value1 = $field->getValue();
$field->getProperties();
$value2 = $field->getValue();
Expected
$value1 === $value2
Actual
$value1 !== $value2
Proposed resolution
Switch from looping over $this->properties
to $this->getProperties()
Remaining tasks
User interface changes
API changes
Data model changes
\Drupal\Core\TypedData\Plugin\DataType\Map::getValue()