Edit report at https://bugs.php.net/bug.php?id=65656&edit=1

 ID:                 65656
 Updated by:         ahar...@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

Reply via email to