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

From: Date: Tue, 23 Jun 2015 19:11:44 +0000
Subject: Req #69914 [Opn->Csd]: Not possible to specify array type as a return type
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-807@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69914&edit=1 ID: 69914 Updated by: kalle@php.net Reported by: tim dot bezhashvyly at gmail dot com Summary: Not possible to specify array type as a return type -Status: Open +Status: Closed Type: Feature/Change Request Package: PHP Language Specification Operating System: Debian GNU/Linux 8 PHP Version: 7.1+ -Assigned To: +Assigned To: kalle Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2015-06-23 19:11:28] kalle@php.net Hi Tim! Sadly this was not covered by the Return Types RFC: https://wiki.php.net/rfc/return_types It is too late to cover for 7.0 now, hence the updated 'version' field in this report. I suggest you mail the internals mailing list for some debate or create an RFC for this once 7.0 have been released and developments began to focus 7.1 ------------------------------------------------------------------------ [2015-06-23 19:09:40] rasmus@php.net There is no such thing as a typed array. ------------------------------------------------------------------------ [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

« previous php.standards (#807) next »