Bug #63592 [Opn->Nab]: class alias are not used/resolved by type hinting
| From: | felipe@php.net | Date: | Fri, 23 Nov 2012 21:49:12 +0000 |
| Subject: | Bug #63592 [Opn->Nab]: class alias are not used/resolved by type hinting | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174879@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63592&edit=1
ID: 63592
Updated by: felipe@php.net
Reported by: frederic dot hardy at mageekbox dot net
Summary: class alias are not used/resolved by type hinting
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: macos X mountain lion
PHP Version: 5.4.9
Block user comment: N
Private report: N
New Comment:
19:48 @ mageekguy >> you can close my bug report, seems that i made a mistake in
my script
Previous Comments:
------------------------------------------------------------------------
[2012-11-23 21:36:15] frederic dot hardy at mageekbox dot net
Description:
------------
Imagine that you have a A class.
Imagine that you have an alias B on this A class.
Imagine that you have a function/method which require a B as argument.
So, currently, it's not possible to pass a A instance as argument to this
function/method.
Test script:
---------------
<?php
class A {}
class_alias('A', 'B');
function foo(B $b) {}
foo(new A());
Expected result:
----------------
Nothing.
Actual result:
--------------
PHP Catchable fatal error: Argument 1 passed to foo() must be an instance of B,
instance of A given, called in /path/to/test/file.php on line 6 and defined in
/path/to/test/file.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63592&edit=1