- Issue created by @szeidler
 - @szeidler opened merge request.
 - Status changed to Needs review
about 2 years ago 10:01am 29 August 2023 - 🇩🇪Germany szeidler Berlin
I created a MR, just straightforward resetting it to what it was before the change.
 - Status changed to Needs work
about 2 years ago 10:05am 29 August 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
That will cause error messages when testing this with PhpStan. There needs to be a way to safely get to those values, especially in PHP 8.1
 - 🇩🇪Germany szeidler Berlin
Can you verify the bug?
Might it be possible to do a
isset($header->key)check? This should trigger the magic__isset()method inDrupal\Core\Field\FieldItemBase - 🇩🇪Germany jurgenhaas Gottmadingen
How about this fully sanitized method:
public function getHeader(): array { $headers = []; /** @var \Drupal\key_value_field\Plugin\Field\FieldType\KeyValueItem $header */ foreach ($this->get('header') as $header) { try { $key = $header->get('key')->getValue(); $value = $header->get('value')->getValue(); $headers[$key] = $value; } catch (MissingDataException $e) { // We can ignore this. } } return $headers; } - 🇩🇪Germany szeidler Berlin
For a missing property it throws a
throw new \InvalidArgumentException("Property $property_name is unknown.");inweb/core/lib/Drupal/Core/TypedData/TypedDataManager.phpon my end. - 🇩🇪Germany jurgenhaas Gottmadingen
I can't reproduce that, it works just fine here.
 - Status changed to Postponed: needs info
7 months ago 11:19am 31 March 2025