Req #78695 [Opn->Sus]: [ Feature req ] Typehints `uint`, `ufloat`, `+', 'resource+' and so on

From: Date: Sat, 19 Oct 2019 12:02:26 +0000
Subject: Req #78695 [Opn->Sus]: [ Feature req ] Typehints `uint`, `ufloat`, `+', 'resource+' and so on
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223293@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78695&edit=1 ID: 78695 Updated by: cmb@php.net Reported by: 6562680 at gmail dot com Summary: [ Feature req ] Typehints uint, ufloat, `+', 'resource+' and so on -Status: Open +Status: Suspended Type: Feature/Change Request Package: *General Issues Operating System: Win10 PHP Version: 7.3.10 Block user comment: N Private report: N New Comment: 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] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2019-10-19 10:49:50] 6562680 at gmail dot com Description: ------------ [ FEATURE REQUEST ] [ NOT A BUG ] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78695&edit=1

« previous php.bugs (#223293) next »