@@ -32,12 +32,15 @@ class UnboundRelationship extends AbstractPropertyObject
3232 /**
3333 * @param CypherMap<OGMTypes> $properties
3434 */
35+ private string $ elementId ;
36+
3537 public function __construct (
3638 private readonly int $ id ,
3739 private readonly string $ type ,
3840 private readonly CypherMap $ properties ,
39- private readonly ?string $ elementId ,
41+ ?string $ elementId = null ,
4042 ) {
43+ $ this ->elementId = $ elementId ?? (string ) $ id ;
4144 }
4245
4346 public function getElementId (): ?string
@@ -55,6 +58,9 @@ public function getType(): string
5558 return $ this ->type ;
5659 }
5760
61+ /**
62+ * @psalm-suppress MixedReturnTypeCoercion
63+ */
5864 public function getProperties (): CypherMap
5965 {
6066 /** @psalm-suppress InvalidReturnStatement false positive with type alias. */
@@ -80,7 +86,11 @@ public function toArray(): array
8086 *
8187 * @return OGMTypes
8288 */
83- public function getProperty (string $ key )
89+
90+ /**
91+ * @psalm-suppress MixedReturnStatement
92+ */
93+ public function getProperty (string $ key ): string
8494 {
8595 /** @psalm-suppress ImpureMethodCall */
8696 if (!$ this ->properties ->hasKey ($ key )) {
0 commit comments