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

Use phpstan return logic to infer return type from argument #419

Closed
wants to merge 1 commit into from

Conversation

ildyria
Copy link
Contributor

@ildyria ildyria commented Apr 10, 2023

As migrating to php 8.2, I had to change utf8_encode (soon deprecated) to mb_convert_encoding.
Unfortunately this function when given a string as input returns a string, and when given an array returns an array.
This fix aims to leverage on phpdoc @return logic to infer the correct return type.

@ildyria
Copy link
Contributor Author

ildyria commented Apr 10, 2023

IDK why this is failing, I don't think the file I modified has impact on this. :|

@shish
Copy link
Collaborator

shish commented Feb 3, 2025

Closing old PRs as lots has changed, feel free to re-open if this is still relevant

(FWIW I tested this in my current master branch, and it broke the generated code because it put ($string is string ? string : array)' verbatim into the function's return type)

@shish shish closed this Feb 3, 2025
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