Skip to content

[TypeDeclarationDocblocks] Widen empty nested array default to mixed[] in DocblockVarArrayFromPropertyDefaultsRector - #8474

Merged
TomasVotruba merged 1 commit into
mainfrom
fix-docblock-var-array-empty-nested
Sep 8, 2026
Merged

[TypeDeclarationDocblocks] Widen empty nested array default to mixed[] in DocblockVarArrayFromPropertyDefaultsRector#8474
TomasVotruba merged 1 commit into
mainfrom
fix-docblock-var-array-empty-nested

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Sep 8, 2026

Copy link
Copy Markdown
Member

Removes the hasEmptyNestedArray guard from DocblockVarArrayFromPropertyDefaultsRector.

A private array property whose default is a map of empty arrays, e.g.:

private array $queryParts = [
    'select' => [],
    'from'   => [],
];

was skipped by the guard, even though widening to @var array<string, mixed[]> is the intended behavior. This restores that. A direct single [] default stays skipped as before (handled by the decorator, not the guard).

The stale conflicting skip_empty_nested_array.php.inc fixture (same input shape, opposite expectation) is removed.

…] in DocblockVarArrayFromPropertyDefaultsRector

Remove the hasEmptyNestedArray guard so a map whose values are empty arrays
(e.g. ['select' => [], 'from' => []]) gets a @var array<string, mixed[]> docblock
instead of being skipped. Only a direct single [] default stays skipped.

Claude-Session: https://claude.ai/code/session_01F6Coa2BZXNc18QhSVkhrYe
@TomasVotruba
TomasVotruba merged commit c55c4ae into main Sep 8, 2026
43 checks passed
@TomasVotruba
TomasVotruba deleted the fix-docblock-var-array-empty-nested branch September 8, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant