On Fri, 18 Jun 2010 16:28:31 +0200, Lukas Kahwe Smith <m...@pooteeweet.org> wrote: > On 18.06.2010, at 16:13, Melanie Rhianna Lewis wrote: > >> >> >> On 17 Jun 2010, at 20:14, Stas Malyshev wrote: >> >>> Hi! >>> >>>> I know the discussion is about scalar type hints. But what is with a >>>> object type hint as base for all objects? >>> >>> When it makes sense to accept any object, regardless of the class, but >>> not other types? I wonder if it's really a common use-case. >> >> Its useful in some patterns. For example suppose you have a pattern >> where a class wraps another class. The wrapped class could be *any* >> class if you're modify the behaviour of some default methods (say doing >> something like a decorator pattern). Having a type hint that recognises >> object vs non objects is useful. > > > isnt this what interfaces are for? > > regards, > Lukas Kahwe Smith > m...@pooteeweet.org
Sure, you can create an empty interface for this scenario but only for self defined classes. All PHP classes can't used with this interface. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php