rfc:mixed-typehint
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
rfc:mixed-typehint [2017/09/22 13:28] – external edit 127.0.0.1 | rfc:mixed-typehint [2017/12/19 02:29] – post-7.2 update majkl | ||
---|---|---|---|
Line 7: | Line 7: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | With the addition of scalar types in PHP 7, nullables in 7.1 and recently object in 7.2, it's now possible to explicitly declare accepted types for most of the parameters and return types. Unfortunately without mixed type it's still not possible to achieve a fully type hinted and consistent code. | + | With the addition of scalar types in PHP 7, nullables in 7.1 and recently object in 7.2, it's now possible to explicitly declare accepted types for most of the parameters and return types. Unfortunately without mixed type it's still not possible to achieve a fully type hinted and consistent code using simple types. |
===== Proposal ===== | ===== Proposal ===== | ||
- | This RFC proposes to add the '' | + | This RFC proposes to add the '' |
Primary motivation for having explicit mixed type is consistence and easier static analysis. | Primary motivation for having explicit mixed type is consistence and easier static analysis. | ||
- | In PHP 7.2, mixed types are unfortunately the only type that could not be type hinted upon (and resource as well, but its future is unclear | + | In PHP 7.2, mixed types are unfortunately the only type that could not be type hinted upon (and resource as well, but its future is unclear). Having mixed type would allow a code with 100% type coverage in most cases. |
- | The behavior of the '' | + | The behavior of the '' |
===== Nullability ===== | ===== Nullability ===== | ||
Line 62: | Line 62: | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | None, '' | + | None, '' |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
- | 7.2 if RMs agree, otherwise | + | 7.3 |
===== RFC Impact ===== | ===== RFC Impact ===== | ||
Line 75: | Line 75: | ||
==== To Opcache ==== | ==== To Opcache ==== | ||
- | None. | + | Not analyzed. |
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== |
rfc/mixed-typehint.txt · Last modified: 2020/07/22 09:03 by kocsismate