Req #69914 [Opn->Nab]: Not possible to specify array type as a return type

[email protected]
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=69914&edit=1

 ID:                 69914
 Updated by:         [email protected]
 Reported by:        tim dot bezhashvyly at gmail dot com
 Summary:            Not possible to specify array type as a return type
-Status:             Open
+Status:             Not a bug
 Type:               Feature/Change Request
 Package:            PHP Language Specification
 Operating System:   Debian GNU/Linux 8
 PHP Version:        7.0.0alpha1
 Block user comment: N
 Private report:     N

 New Comment:

There is no such thing as a typed array.


Previous Comments:
------------------------------------------------------------------------
[2015-06-23 19:04:51] tim dot bezhashvyly at gmail dot com

Description:
------------
Specifying specific array type as a return type of a method/function produces a syntax error.

Test script:
---------------
function foo(): string[]
{
    return ['bar'];
}

Actual result:
--------------
Parse error: syntax error, unexpected '[', expecting ';' or '{' in ...


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69914&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.