Bug #71167 [NEW]: Missing documentation, that type declaration doesn't support aliases
| From: | daniel dot korner at tu-dortmund dot de | Date: | Sat, 19 Dec 2015 11:33:35 +0000 |
| Subject: | Bug #71167 [NEW]: Missing documentation, that type declaration doesn't support aliases | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-12990@lists.php.net to get a copy of this message | ||
From: daniel dot korner at tu-dortmund dot de
Operating system:
PHP version: 7.0.1
Package: Documentation problem
Bug Type: Bug
Bug description:Missing documentation, that type declaration doesn't support aliases
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 bug report at https://bugs.php.net/bug.php?id=71167&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71167&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71167&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71167&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71167&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71167&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71167&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71167&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71167&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71167&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71167&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71167&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71167&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71167&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71167&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71167&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71167&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71167&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71167&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71167&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71167&r=mysqlcfg