Bug #54532 [Bgs]: class_alias and type hint
| From: | david at grudl dot com | Date: | Tue, 19 Apr 2011 19:48:06 +0000 |
| Subject: | Bug #54532 [Bgs]: class_alias and type hint | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160289@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54532&edit=1
ID: 54532
User updated by: david at grudl dot com
Reported by: david at grudl dot com
Summary: class_alias and type hint
Status: Bogus
Type: Bug
Package: Class/Object related
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Please, re-open this bug.
Previous Comments:
------------------------------------------------------------------------
[2011-04-14 17:13:35] david at grudl dot com
No, alias was created, I have used eval(). Or put second class in extra
file and
use include, result is the same.
------------------------------------------------------------------------
[2011-04-14 15:25:06] felipe@php.net
This is an error in parsing-time, the alias in this point was not
created yet... So we cannot use the alias name in the type hint.
------------------------------------------------------------------------
[2011-04-14 14:52:12] david at grudl dot com
Description:
------------
class_alias() is not taken into account by type hints.
Test script:
---------------
<?php
class A
{
function foo(A $param) {
}
}
class_alias('A', 'AliasA');
eval('
class B extends A
{
function foo(AliasA $param) {
}
}
');
Expected result:
----------------
no error
Actual result:
--------------
Strict Standards: Declaration of B::foo() should be compatible with that
of A::foo()
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54532&edit=1