Skip to content

Add omission hints to return values#5544

Merged
jordikroon merged 9 commits intophp:masterfrom
shaedrich:patch-4
May 7, 2026
Merged

Add omission hints to return values#5544
jordikroon merged 9 commits intophp:masterfrom
shaedrich:patch-4

Conversation

@shaedrich
Copy link
Copy Markdown
Contributor

@shaedrich shaedrich commented May 6, 2026

image

Copy link
Copy Markdown
Member

@jordikroon jordikroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't really an equivalent. So we can omit that.

Comment thread reference/errorfunc/functions/debug-backtrace.xml Outdated
Comment thread reference/errorfunc/functions/debug-backtrace.xml Outdated
shaedrich and others added 4 commits May 6, 2026 23:38
@shaedrich
Copy link
Copy Markdown
Contributor Author

shaedrich commented May 6, 2026

Do you have a working example where object is null? My assumption is that if it would be null it would be omitted.

Yeah, it's not exactly right, I'd be omitted, which, aside from emitting a warning if trying to access it, is treated as null as well as being considered null by is_null() and even in strict comparison with null—how would you describe that as a type?

(in reply to #5545 (comment))

@jordikroon
Copy link
Copy Markdown
Member

jordikroon commented May 7, 2026

Do you have a working example where object is null? My assumption is that if it would be null it would be omitted.

Yeah, it's not exactly right, I'd be omitted, which, aside from emitting a warning if trying to access it, is treated as null as well as being considered null by is_null() and even in strict comparison with null—how would you describe that as a type?

(in reply to #5545 (comment))

It wouldn't be right to change the signature because of that. PHP doesn't have an undefined type like javascript. So if it isn't there, it isn't there. The table already explicitly mentions that Possible returned elements from. Indicating that if may or may not return all values.

The types should stay object and string. They have also wrongfully been changed to array (+ null).

shaedrich and others added 2 commits May 7, 2026 14:32
as PHP does not have an explicit undefined type

Co-authored-by: Jordi Kroon <jkroon@onyourmarks.agency>
Copy link
Copy Markdown
Member

@jordikroon jordikroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!

@jordikroon jordikroon merged commit a8dfc2c into php:master May 7, 2026
2 checks 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