|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-03 19:13 UTC] sean at acidreign dot net
[2006-04-03 12:45 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 23:00:01 2025 UTC |
Description: ------------ When you have a type-hint error (ie: you pass an incompatible object to a function with a type hint), the error message is completely useless. It tells you where the function with the type hint is defined; it *should* tell you where you tried to pass the invalid object. Logically, this makes sense. If I pass an object that doesn't fit the type hint, it's not the function that's at fault; it's mine. Reproduce code: --------------- <?php class x { } class y { } function func(x $x) { return; } func(new y()); ?> Expected result: ---------------- Fatal error: Argument 1 must be an instance of x in c:\Inetpub\wwwroot\test.php5 on line 12 Actual result: -------------- Fatal error: Argument 1 must be an instance of x in c:\Inetpub\wwwroot\test.php5 on line 8