Re: PHP 7.1 - Address PHPSadness #28?
| From: | François Laupretre | Date: | Wed, 23 Sep 2015 21:17:21 +0000 |
| Subject: | Re: PHP 7.1 - Address PHPSadness #28? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88458@lists.php.net to get a copy of this message | ||
Le 23/09/2015 18:37, Stig Bakken a écrit :
I don't say it's more readable than isset(), I say that's more readable than array_key_exists().If they start replacing calls to isset()/array_key_exists() with exists(), that's their choice and it can only improve overall readability.The thing is, it won't really improve overall readability, because the name exists() is still too vague. It may be obvious to the person who wrote the code (at least for the first two weeks), then you're really back into the same vagueness that isset() provides.
I am all for adding ArrayAccess support to array_key_exists() and other functions where it is not handled. The same for property_exists() and magic methods. I'm just afraid of endless discussions about potential BC breaks :) Regards FrançoisAnd the right thing to do. Or would you want to have to add special cases for code depending on whether something was an object and imlemented ArrayAccess? (There are a lot of cases where ArrayAccess support is wanting, but that's a different issue.)Possible, yes.- array_key_exists() does not handle objects implementing ArrayAccess,Sounds like something which could be fixed in array_key_exists, or easily added to hasitem() without all the other baggage.