Hi!

> Nothing prevents it? As far as I'm aware there's no current way to type
> hint Countable or array.

No, there's not - as there's no way to make other complex type
conditions as type. You still can check for it, or just use count().

> How would one add an interface that includes Countable and arrays?

You can not add interface that includes multiple types. Neither should
you, that's not what interfaces are for. Inventing one-off complex type
expressions for one-off cases just makes language more complex and less
consistent. It's not a good direction to develop, and it serves very
narrow use case which can easily be served by simple code.

-- 
Stas Malyshev
smalys...@gmail.com

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

Reply via email to