Skip to content

Commit ed0b48a

Browse files
abnegateclaude
andcommitted
(fix): add PHPStan type assertions for Document constructor calls
The $value from getAttribute() is typed as mixed. After array_is_list() check confirms string keys, PHPStan still needs an explicit assertion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 49e2dea commit ed0b48a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Database/Hook/Relationships.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function afterDocumentCreate(Document $collection, Document $document): D
148148

149149
try {
150150
if (\is_array($value) && ! \array_is_list($value)) {
151+
/** @var array<string, mixed> $value */
151152
$value = new Document($value);
152153
$document->setAttribute($key, $value);
153154
}
@@ -286,6 +287,7 @@ public function afterDocumentUpdate(Document $collection, Document $old, Documen
286287
$value = $document->getAttribute($key);
287288

288289
if (\is_array($value) && ! \array_is_list($value)) {
290+
/** @var array<string, mixed> $value */
289291
$value = new Document($value);
290292
$document->setAttribute($key, $value);
291293
}

0 commit comments

Comments
 (0)