bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.61k stars 94 forks source link

max() return a type based on the arguments #2815

Open momala454 opened 7 months ago

momala454 commented 7 months ago

Describe the bug We can know the type of max() instead of simply showing "mixed". When all arguments are of the same type, the output will be the same. When it's different, it's more complicated however.

To Reproduce

var_dump(max(1,2));

Expected behavior An int, not mixed

Screenshots image

Platform and version 1.10.2

bmewburn commented 7 months ago

Yes, could be difficult in cases where different types are passed. eg max(1,'10') will be string, max(10,'1') will be int. With some custom handling it could be done, but I don't think it can be handled in a general sense with templates.

momala454 commented 7 months ago

could something be made for when all arguments are the same type and keep mixed when they are different ?