Restrict type of method parameter with two or more class names?

Posted by Kirzilla on Stack Overflow See other posts from Stack Overflow or by Kirzilla
Published on 2010-04-18T21:34:48Z Indexed on 2010/04/18 21:43 UTC
Read the original article Hit count: 105

Filed under:

Hello,

We can restrict type of method parameters; for example, we should say that function parameter should be an instance of object described in class with name "Some Class".

function some_function(Some_Class $object) {
}

Is there any php native posibilities to restrict method parameter with two or more classes? For examle, "Some Class" or "Some Class2" or "Some Class3".

Or maybe there is any way to restrict method parameter with classes which implements interface with name "Some_Interface"?

Thank you.

© Stack Overflow or respective owner

Related posts about php