Le 23/09/2015 18:37, Stig Bakken a écrit :

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 don't say it's more readable than isset(), I say that's more readable than array_key_exists().

- 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.

Possible, yes.

And 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.)

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çois

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to