Skip to content

Commit 5b448a7

Browse files
committed
HasOffsetValueType - fix traverse
1 parent b8f2d5d commit 5b448a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Type/Accessory/HasOffsetValueType.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ public function toArray(): Type
215215

216216
public function traverse(callable $cb): Type
217217
{
218-
return $this;
218+
$newValueType = $cb($this->valueType);
219+
if ($newValueType === $this->valueType) {
220+
return $this;
221+
}
222+
223+
return new self($this->offsetType, $newValueType);
219224
}
220225

221226
public static function __set_state(array $properties): Type

0 commit comments

Comments
 (0)