Could not verify return type when union array<> and arraylike-object<>
Open
Nobody has claimed this yet.
bug
- Dominant language
- PHP
- Stars
- 5.9k
- Forks
- 708
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 25
Description
Hi,
I am not sure if I am missing something, but I would expect that psalm could identify the return type here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported case using the Psalm playground link https://psalm.dev/r/a113e1d2e7 and compare the inferred return type with the expected type. Trace the type-inference path for a union of array and arraylike-object, then add coverage demonstrating the expected result once the relevant implementation area is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100