|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78695 [ Feature req ] Typehints `uint`, `ufloat`, `+', 'resource+' and so on
Submitted: 2019-10-19 10:49 UTC Modified: 2019-10-19 12:02 UTC
From: 6562680 at gmail dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: 7.3.10 OS: Win10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: 6562680 at gmail dot com
New email:
PHP Version: OS:


 [2019-10-19 10:49 UTC] 6562680 at gmail dot com

uint - unsigned int (0,1,2,3)
ufloat - unsigned float

resource (replace to opened OR closed resource)

stack (array w/ordered ("default") int keys 0,1,2,3)
list (array w/non-ordered int keys 1,4,3,0)
assoc (array w/both int/string keys but fatal if only int/only string keys)
dict (array w/string keys)

+ - non-empty
resource+ (opened resource)
int+ (1,2,3... but fatal if 0)
float+ (0.01, 0.02 but fatal if 0.0)
string+ (at least one letter or fatal)
array+ (at least one item or fatal)

would be great to but not so required
string[] // list(!) of strings
Object[] // list(!) of objects

and i know that will be implemented in 7.4 - co-return 'string|array', 'OneInterface|TwoInterface'

Test script:
function hello(? int $limit)
  // damn i need this every time
  $limit = max(0, $limit);
  if (0 === $limit) throw \InvalidArgumentException('Error');
  // yes, i can: $limit = max(1, $limit);
 // and somewhere i could expect fatal error if 0 is going from another function, but this function wont throw and will work like 1 passed

Expected result:
Reduce count of if/elses + exceptions required when you writing simple scripts (usually required by Saas flow)

Actual result:
tonns of "if/else"
making properties to separate objects to "true OOP"

and then projects with 1500 files... instead of 100.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-19 12:02 UTC]
-Status: Open +Status: Suspended
 [2019-10-19 12:02 UTC]
This feature requires discussion on the internals mailing list,
and likely the RFC process[1].  Please start the discussion there;
for the time being I'm suspending this ticket.

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Apr 13 10:01:22 2021 UTC