Req #65656 [Opn]: Error message when type hinting is ambigious

From: Date: Thu, 12 Sep 2013 01:07:25 +0000
Subject: Req #65656 [Opn]: Error message when type hinting is ambigious
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-181538@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65656&edit=1 ID: 65656 Updated by: aharvey@php.net Reported by: ss23 at ss23 dot geek dot nz Summary: Error message when type hinting is ambigious Status: Open Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Makes sense to me. Pull request implementing this on master for someone with Zend karma: https://github.com/php/php-src/pull/442 Previous Comments: ------------------------------------------------------------------------ [2013-09-12 00:29:13] ss23 at ss23 dot geek dot nz Description: ------------ When you type hint with a name of a type PHP has, the error message is ambiguous and confusing. Test script: --------------- function foo(boolean $bar) { var_dump($bar); } foo(true); Expected result: ---------------- Catchable fatal error: Argument 1 passed to foo() must be an instance of the class boolean, non-class of type boolean given, called in /code/VhrCdK on line 11 and defined in /code/VhrCdK on line 3 This is just my first thoughts on how to make it less confusing. Other suggestions would be apperciated. Actual result: -------------- Catchable fatal error: Argument 1 passed to foo() must be an instance of boolean, boolean given, called in /code/VhrCdK on line 11 and defined in /code/VhrCdK on line 3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65656&edit=1

« previous php.bugs (#181538) next »