Skip to content

Commit e9dad23

Browse files
committed
fix Possibly invalid array key type string|null.
1 parent 0bcac0a commit e9dad23

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/Block.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ public function set(int|string $key, mixed $value, string $charNestedKey = "."):
165165

166166
$array = &$array[$key];
167167
}
168+
$key = array_shift($keys);
169+
170+
if (!is_null($key)) {
171+
$array[$key] = $value;
172+
}
168173

169-
$array[array_shift($keys)] = $value;
170174
return $this;
171175
}
172176
$this->data[$key] = $value;

tests/Feature/QueryBlockTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134

135135
$story = Block::fromJsonString($jsonString);
136136
$assets = $story->extractWhere("fieldtype", "asset");
137-
$assets->dump();
138137
expect($assets)->toHaveCount(16);
139138
expect($assets->get("3.filename"))->toStartWith("https://a.story");
140139
});

0 commit comments

Comments
 (0)