Bug #71167 [Asn->Csd]: Missing documentation, that type declaration doesn't support aliases
| From: | tpunt@php.net | Date: | Sat, 19 Dec 2015 20:02:08 +0000 |
| Subject: | Bug #71167 [Asn->Csd]: Missing documentation, that type declaration doesn't support aliases | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12999@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71167&edit=1
ID: 71167
Updated by: tpunt@php.net
Reported by: daniel dot korner at tu-dortmund dot de
Summary: Missing documentation, that type declaration doesn't
support aliases
-Status: Assigned
+Status: Closed
Type: Bug
Package: Documentation problem
PHP Version: 7.0.1
Assigned To: tpunt
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2015-12-19 20:01:51] tpunt@php.net
Resolved with commit: https://svn.php.net/viewvc?view=revision&revision=338328
I decided to make it a warning since I can see this being a common issue.
------------------------------------------------------------------------
[2015-12-19 20:00:26] tpunt@php.net
Automatic comment from SVN on behalf of tpunt
Revision: http://svn.php.net/viewvc/?view=revision&revision=338328
Log: Resolve doc bug #71167
------------------------------------------------------------------------
[2015-12-19 11:33:32] daniel dot korner at tu-dortmund dot de
Description:
------------
Just recently I found out that type declaration does not support aliases[1]. This is a piece of
information that is currently missing in the documentation[2]. Therefore, I propose to add this
information to the documentation. Maybe together with my test script and a detailed explanation of
what the error means.
[1]
http://marc.info/?l=php-general&m=145030898711430&w=2
[2]
http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration
Test script:
---------------
<?php
function bar(boolean $foo): boolean{return $foo;}
var_dump(bar((bool)true));
?>
Expected result:
----------------
bool(true)
Actual result:
--------------
PHP Fatal error: Uncaught TypeError: Argument 1 passed to bar() must be an instance of boolean,
boolean given, called in ./example4.php:2
Stack trace:
#0 ./example4.php(3): bar(true)
#1 {main}
thrown in ./example4.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71167&edit=1