php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62734 [Feature Request]Multiple typehint support
Submitted: 2012-08-03 04:04 UTC Modified: 2012-08-03 04:12 UTC
From: k at webnfo dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5.4.5 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: k at webnfo dot com
New email:
PHP Version: OS:

 

 [2012-08-03 04:04 UTC] k at webnfo dot com
Description:
------------
With Multiple typehint support, function arguments can accept multiple specific type of data.

The syntax would be like this:

function demo(TypeA|ClassA|Array $var){

}

Which will accept the one of those types: TypeA, ClassA, Array as valid argument.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-03 04:12 UTC] aharvey@php.net
-Status: Open +Status: Duplicate
 [2012-08-03 04:12 UTC] aharvey@php.net
Previously requested as request #31785. I don't think anything's changed, really: the stock advice of using an interface that defines the API you expect to be implemented stands, and I don't think the object-or-array case is important enough to merit this sort of change.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 12:01:29 2024 UTC