On 05/07/2016 22:06, Levi Morrison wrote:
Compare that to using only if-else for control flow:
if ($type->isBuiltin()) {
handle_builtin();
} else if ($type instanceof ReflectionClassType) {
handle_class($type);
} else {
handle_undefined($type);
}
I'd much prefer the latter.
Yeah, I agree the control flow looks more natural with an elseif there.
But that fits fine with my other suggestion:
if ($type->isBuiltin()) {
handle_builtin();
} else if ( object_type_exists($type->getName()) ) {
handle_class($type);
} else {
handle_undefined($type);
}
As I say, if you dislike the verbosity and future-proofing of
"class_exists() || interface_exists()", then that's not uniqe to this
situation, but a general lack in the language. Why add methods or whole
types to this one area of reflection rather than providing a more basic
building block?
It would have been great if people actually contributed to the
discussion before voting phase, but such is life.
Yes, for my part, I apologise that I didn't pay any attention to this
RFC previously, and just happened upon this sub-thread. I can understand
your frustration at this all coming so late.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php