Skip to content

feat: add Psl\Type\nullish() return type provider#18

Merged
azjezz merged 2 commits intophp-standard-library:mainfrom
veewee:nullish
Mar 16, 2026
Merged

feat: add Psl\Type\nullish() return type provider#18
azjezz merged 2 commits intophp-standard-library:mainfrom
veewee:nullish

Conversation

@veewee
Copy link
Copy Markdown
Collaborator

@veewee veewee commented Mar 16, 2026

Summary

  • Add return type provider for Psl\Type\nullish() that infers T|null by combining the argument type with null via Type::combineUnionTypes()
  • Remove dead TNonEmptyList branches from Iter handlers (type was removed from Psalm, now represented as TKeyedArray/TNonEmptyArray which are already handled)
  • Suppress UnusedClass on Plugin (loaded externally by Psalm)

Test plan

  • Psalm passes with zero errors
  • New provider mirrors existing optional() pattern

veewee added 2 commits March 16, 2026 08:55
Infers T|null for Psl\Type\nullish($type) calls, mirroring the
existing optional() provider but combining with null instead of
setting possibly-undefined.
Remove dead TNonEmptyList branches from Iter handlers. This type was
removed from Psalm and is now represented as TKeyedArray (is_list) or
TNonEmptyArray, both of which are already handled.

Suppress UnusedClass on Plugin (loaded externally by Psalm).
@azjezz azjezz changed the title Add Psl\Type\nullish() return type provider feat: add Psl\Type\nullish() return type provider Mar 16, 2026
@azjezz azjezz merged commit 7c120dc into php-standard-library:main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants