laravel-ide-macros icon indicating copy to clipboard operation
laravel-ide-macros copied to clipboard

Mixed return type includes null

Open edgrosvenor opened this issue 1 year ago • 1 comments

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.

edgrosvenor avatar Nov 11 '22 08:11 edgrosvenor