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

From: Date: Mon, 05 Feb 2018 12:14:33 +0000
Subject: Req #65656 [Opn->Csd]: Error message when type hinting is ambigious
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213817@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: cmb@php.net Reported by: ss23 at ss23 dot geek dot nz Summary: Error message when type hinting is ambigious -Status: Open +Status: Closed Type: Feature/Change Request Package: Scripting Engine problem PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Since PR 3073 has also been accepted, I'm closing this ticket. Previous Comments: ------------------------------------------------------------------------ [2018-02-04 21:58:39] cmb@php.net FTR: this is in the progress of being resolved. PR 3071 has already been accepted, and there is PR 3073 would solve the issue wrt. to boolean. ------------------------------------------------------------------------ [2013-09-12 01:07:25] aharvey@php.net Makes sense to me. Pull request implementing this on master for someone with Zend karma: https://github.com/php/php-src/pull/442 ------------------------------------------------------------------------ [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 (#213817) next »