Hi! > namespace Application; > function log(Eloquent\Collection | Haldayne\Map $entity) { > $logger->log($entity->toArray()); > }
This is bad design. It assumes that two completely unrelated classes have the same function and it means the same. If it's indeed true, we have a way to express it. It's called "interface". If it's not true, and you are just duck-typing, you should not pretend you use strict types, and drop types completely. You shouldn't try yo sit on both chairs at the same time and pretend you're using strict typing while in fact duck-typing. > "Ugh, this is much easier in multi-catch. If only functions took > multiple types, this would be much simpler to write." And it would be completely wrong, abuse of typing. If you mean to say "anything that has log method", you should either have interface or just get rid of the strictness and duck-type it and rely on PHP to throw exception if anything happens. Otherwise it is just a sloppy design. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php