Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Mixed return type includes null #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

edgrosvenor
Copy link

This PR prevents appending ? to nullable return types if the return type is mixed because mixed already includes null. Appending the ? causes php-lint to complain. For now, I've just excluded _ide_macros.php from php-lint in CI so this is low-impact for me. But it might be helpful to others.

I'm not sure this solution is 100% complete. I haven't read the code carefully enough to see how pipe-joined mixed return types are handled and what would happen if the return type were something like string|int|null. Obviously in that case, the ? should also not be appended. Let me know if you think that's something that I should explore further.

Thanks for the great package! It's made my life a whole lot easier.

@KristofMorva
Copy link
Owner

Hey @edgrosvenor, sadly I'm not in the PHP / Laravel ecosystem anymore, so I have no idea about any of this anymore :')
To be honest, I'm very surprised that this package still works at all after so many years 😅

For now I'd suggest using a fork with your own fixes, as I'll be unable to verify whether this change works well or not :/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants