|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-11-23 21:36 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 07:00:01 2025 UTC |
19:48 @ mageekguy >> you can close my bug report, seems that i made a mistake in my script