|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-09-18 15:02 UTC] bjori@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Description: ------------ When you have a type-hint error, the error message reports only the class the object should be, not the type it actually is: Argument 1 must be an instance of Bar in hints.php on line 3 My experience so far indicates it would be tremendously helpful in debugging to know what class the object actually belongs to. As it is, I have to to *remove* the type hint and add a test inside the method to get that information. (I typically throw an exception to get a full stack trace.) Reproduce code: --------------- class Foo { public function process(Bar $bar) {} } class Bar {} class Baz {} $foo = new Foo; $foo->process(new Baz); Expected result: ---------------- Desired result: Argument 1 is an instance of Baz, must be an instance of Bar in hints.php on line 3 Actual result: -------------- Argument 1 must be an instance of Bar in hints.php on line 3