Edit report at https://bugs.php.net/bug.php?id=63592&edit=1

 ID:                 63592
 Updated by:         fel...@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

Reply via email to