php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75935 Allow usage of multiple type hints
Submitted: 2018-02-08 10:21 UTC Modified: 2018-02-08 10:24 UTC
From: francois5537 at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: *Programming Data Structures
PHP Version: 7.2.2 OS: Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: francois5537 at gmail dot com
New email:
PHP Version: OS:

 

 [2018-02-08 10:21 UTC] francois5537 at gmail dot com
Description:
------------
I don't know if this already has been reported or already supported, sorry if this is the case.

Test script:
---------------
<?php
function canBeArrayOrString(string|array $route) {
  // Don't allow object, int, etc.!
}

Expected result:
----------------
Something like 'Must be string, array - object given!'

Actual result:
--------------
Valid when array or string has been given.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-08 10:24 UTC] peehaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: peehaa
 [2018-02-08 10:24 UTC] peehaa@php.net
This has already been proposed:

https://wiki.php.net/rfc/union_types

It may be revisited again later.
 [2018-02-08 10:26 UTC] peehaa@php.net
Also see the related discussion here: https://externals.io/message/92274
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC