Req #75935 [Com]: Allow usage of multiple type hints

From: Date: Thu, 08 Feb 2018 10:26:10 +0000
Subject: Req #75935 [Com]: Allow usage of multiple type hints
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213864@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75935&edit=1 ID: 75935 Comment by: peehaa@php.net Reported by: francois5537 at gmail dot com Summary: Allow usage of multiple type hints Status: Closed Type: Feature/Change Request Package: *Programming Data Structures Operating System: Linux PHP Version: 7.2.2 Assigned To: peehaa Block user comment: N Private report: N New Comment: Also see the related discussion here: https://externals.io/message/92274 Previous Comments: ------------------------------------------------------------------------ [2018-02-08 10:24:06] 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:21:16] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75935&edit=1

« previous php.bugs (#213864) next »