Skip to content
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

Add phpdoc to TransformableData.php #930

Closed
wants to merge 3 commits into from

Conversation

matthiasweiss
Copy link
Contributor

I was running into an issue with phpstan on level 10, when I try to create an object using the toArray() method.

The code I have looks like this:

Model::create($data->toArray())

This results in the following error:

Model>>::create() expects array<string, mixed>, array<mixed> given.

Adding phpdoc to the definition of the class should fix this issue.
Since I was already touching this concern, I decided to add the phpdoc to the other methods returning arrays as well.

@rubenvanassche
Copy link
Member

Technically it kan return array<array-key, mixed>, can you change that?

@matthiasweiss
Copy link
Contributor Author

Alright, seems as if this is far more complex than I'd have hoped :(

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