Hello Stanislav,
Sunday, May 9, 2004, 12:58:48 PM, you wrote:
DR>>>I was also wondering if the following would also work:
DR>>>
DR>>>class b extends a { }
DR>>>
DR>>>function foo (a $obj) { }
DR>>>
DR>>>$b = new b;
DR>>>foo($b);
DR>>>
DR>>>(ie, an inherited class also passes the hint check)
> This should definitely work. As I see from current code, it also does :)
It works. What we cannot do is inheriting a function and specifying
a base class typehint:
class Root {
}
class Base {
function f(Base $p) {}
}
class Leaf {
function f(Root $p) {}
}
It is doable as the following patch shows:
http://somabo.de/php/ext/ze2/ze2-type-hint-classes-20040327.diff.txt
(the patch me be a little bit outdated though).
I guess this can pretty good wait for 5.1.
marcus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php