On Mon, Jul 11, 2011 at 09:25, Stas Malyshev <smalys...@sugarcrm.com> wrote:
> 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.

Isn't this exactly why is_a() was un-deprecated in the firstplace?

Getting warnings from is_a() would be very weird.

-Hannes

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

Reply via email to