Hi! > All right, your method accepts an array of objects, instances of Foo. How do > you enforce this contract?
You are trying to re-invent generics/parametrized types and bolt it onto PHP. I still don't think it is a good idea - PHP is not a statically typed language. Just check you array elements if you need. > What's your proposal? From the discussion so far, I'd guess it's peppering > out code with if-s with the same error written everywhere everytime we check > the item in an array. By "peppering" here you mean one if. Yes, this is my proposal - if you need to do a check - do a check. > The same applies to typehints, so make up your mind. No it does not. But this is exactly why I think one of the problems with strict typing in arguments is - because people take it and starting to use it as a legitimation of turning PHP into weird hybrid of dynamically typed language with random islands of static typing popping in random places. I still do not think it is a good idea. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php