Req #43745 [Sus->Csd]: Scalar type hinting
| From: | levim@php.net | Date: | Sun, 08 Apr 2018 18:05:10 +0000 |
| Subject: | Req #43745 [Sus->Csd]: Scalar type hinting | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214650@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=43745&edit=1
ID: 43745
Updated by: levim@php.net
Reported by: sam at sambarrow dot com
Summary: Scalar type hinting
-Status: Suspended
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: *
PHP Version: *
-Assigned To:
+Assigned To: levim
Block user comment: N
Private report: N
New Comment:
Nearly all of this has been implemented as of PHP 7.2. We don't allow the duplicate names for
scalar types. We also don't have "resource" or "num"/"number".
I'm sure we have bugs for those somewhere; when I find them I'll link to them.
Previous Comments:
------------------------------------------------------------------------
[2010-01-25 20:09:42] alll-developers at php dot world
Why won't these type hintings be implemented?
For me and every serious PHP Developer in the world it would be so cool to have that feature
------------------------------------------------------------------------
[2008-01-04 15:46:15] pajoye@php.net
won't fix > suspended.
There is a discussion about such features and no, it is not yet done.
------------------------------------------------------------------------
[2008-01-04 15:09:13] helly@php.net
We will not implement scalar type hints.
Check the archives on the exact why.
For pure hinting you can use pecl/SPL_Types which will act like Java autoboxing.
------------------------------------------------------------------------
[2008-01-04 04:51:27] sam at sambarrow dot com
Description:
------------
Requesting support for scalar type hinting. I have a fully working patch written, I have been using
it myself with no problems for a couple of months.
Full specs:
Type hinting patch allows for 8 new type hints, in addition to array and class type hinting.
- Integers (specified by "int", "integer", or "long")
- Floats (specified by "float", "double", or "real")
- Numbers (matches integers and floats, specified by "num" or "number")
- Strings (specified by "string")
- Booleans (specified by "bool" or "boolean")
- Scalars (matches strings, booleans, and numbers; specified by
"scalar")
- Resources (specified by "resource")
- Objects (matches any object, specified by "object")
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=43745&edit=1