> It looks like your message is missing at least a link Sorry, I am using gmail and have attached an image which you probably can't see.
 On Sun, Feb 28, 2021 at 3:07 PM AllenJB <php.li...@allenjb.me.uk> wrote: > > On 28/02/2021 12:49, Eugene Sidelnyk wrote: > > Hi there! > > I faced a lack of methods overloading in PHP once again and would like to > > ask will it be implemented at some point? > > As well, I want you to show some pros and cons which you see in this > > feature. > > > > Here're some thoughts about this by Yegor Bugayenko: > > > It looks like your message is missing at least a link. A quick search > did however turn up a tweet where Yego suggests it's a code smell (which > basically echos my thoughts below): > https://twitter.com/yegor256/status/932701585339240449 > > A quick search shows the most recent discussion on method overloading > here appears to be: https://externals.io/message/104073 > > The big problem with implementing method overloading in PHP is its > typing system. It might be possible to implement it in certain cases > where types are strictly defined for all parameters and return values, > but I suspect there would still be issues over scalar types > (particularly int/float) and union types. > > My personal opinion is that method overloading is unnecessary, and can > be detrimental to code readability when not used carefully. Without it I > think developers are forced to name methods that do similar things more > concisely, while when it's available they're more likely to create a > "single" generically named, overloaded method whose behavior can differ > depending on the inputs. > >