Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add dynamic return type extension for get_object_vars #2268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BackEndTea wants to merge 1 commit into phpstan:1.10.x
base: 1.10.x
Choose a base branch
Loading
from BackEndTea:feat/object-vars-ext

Conversation

@BackEndTea
Copy link
Contributor

@BackEndTea BackEndTea commented Feb 28, 2023

No description provided.

voku reacted with thumbs up emoji
Copy link
Contributor Author

@BackEndTea BackEndTea Feb 28, 2023

Choose a reason for hiding this comment

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

I'm not sure if this is the correct way of doing this, i'm open to suggestions.

case Three = 3;
}

function check(Suit $suit, SuitBacked $backed, NumBacked $num): void
Copy link
Contributor Author

@BackEndTea BackEndTea Feb 28, 2023

Choose a reason for hiding this comment

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

I personally want aware how get_object vars worked on an enum: https://3v4l.org/6hV36

Copy link
Contributor Author

So, the issue now is that there may be 'extra' keys in the array, if the class is not final. (https://3v4l.org/hM8MU)

Is there any way to indicate that the array may have more keys?

Copy link
Contributor

jrmajor commented Sep 13, 2023

Is there any way to indicate that the array may have more keys?

@BackEndTea Currently there isn't, see Psalm 5 announcment and phpstan/phpstan#8438.

Copy link
Contributor

So, the issue now is that there may be 'extra' keys in the array, if the class is not final. (3v4l.org/hM8MU)

Is there any way to indicate that the array may have more keys?

Currently you have to return null as soon as you encounter a non final class.

But more important, I think your implementation is wrong (and the right one might be really complex) because uninitialized properties are not in the array https://3v4l.org/XDYC7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /