Hi!

On 7/11/11 12:18 AM, Dmitry Stogov wrote:
Hi Ralph,

I don't have strong opinion about your suggestion.

In some cases this warning might help to find a typo, in others it may
be useless, but anyway, I think that usage of undefined class name is a
quite rare situation. I would prefer to keep it as is.

It's not as rare, if people use is_a the same way as instanceof. Example I've seen recently - suppose you've got a method that receives either instance of an object or it's ID, something like this:

function process($obj)
{
  if(!is_a($obj, "MyClass") {
     $obj = new MyClass($obj);
  }
  // process $obj
}

Here you've got a new warning. Of course, you could do just $obj instanceof MyClass, but it's a very subtle distinction which many people miss. So the thing here is not that $obj has unknown class name - it's not even a class name at all.

--
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

Reply via email to