Addshore added a comment. I prefer instance of over method_exists when reading code, I have no idea how the php internals actually handle this.
As for speed http://stackoverflow.com/questions/28767294/instanceof-or-method-exist-which-one-should-use says instanceof is marginally faster. As for having something called CheckableForEmptiness, the use of this in typehints for method params is probably rather limited when thinking directly. But Item & Property could probably implement this CheckableForEmptiness thing. But then we may as well just add this thing to EntityDocument and be done with it. TASK DETAIL https://phabricator.wikimedia.org/T109581 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Addshore Cc: Addshore, JeroenDeDauw, Aklapper, Wikidata-bugs, aude, Malyacko _______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
