4 ms·
I get why it's being done that way, but the bit about parameter names being allowed to vary in subclasses feels... non-great. As a result you can't really safe
by zerocrates 6y ago
I get why it's being done that way, but the bit about parameter names being allowed to vary in subclasses feels... non-great.
As a result you can't really safely use named parameters on calls without more extensive control of what you're being passed: even if you typehint to a class or interface, you can just get passed a parameter-name-changed subclass that breaks your call anyway. Feels like a "strict" type warning would be in order rather than just silent acceptance of the variance combined with a hard error.
- masklinn 6y ago> I get why it's being done that way, but the bit about parameter names being allowed to vary in subclasses feels... non-great. As justified, it feels necessary for backwards-compatibility reasons since named arguments are not defined as named, just used as such.
- zerocrates 6y agoStill feels like a "strict warning" situation. Again, I can see why they have to do it that way because this was just not previously part of the public interface to a function, but it is now, so there should be some indication that doing this name mixing is, in fact, Now A Problem. I guess it can just be handled on a static analysis/code-checker kind of level, but the language already has a system for emitting these kind of "code standards" warnings.
- richthegeek 6y agoThat's always been the way with PHP. It's always been the language of "you _can_ write nice code, but only if you follow strict rules and avoid this (long) list of bad practices that it encourages". > Doctor, it hurts when I bend my elbow like this! > So don't bend your elbow like that.