i would like to do something like this:
class CCC {}
function abc(array of CCC $variable)
Is this possible in php?
i would like to do something like this:
class CCC {}
function abc(array of CCC $variable)
Is this possible in php?
No.
You'll need to manually check:
function foo(array $arr) {
if (array_filter($arr, function ($i) { return !($i instanceof CCC); })) {
throw new InvalidArgumentException('Array must contain instances of CCC');
}
...
}