rfc:intersection_types
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:intersection_types [2016/04/27 17:28] – levim | rfc:intersection_types [2016/04/27 17:56] – levim | ||
---|---|---|---|
Line 29: | Line 29: | ||
// Fatal error: Uncaught TypeError: Argument 1 passed to RecordsToList() must be Countable and Traversable, | // Fatal error: Uncaught TypeError: Argument 1 passed to RecordsToList() must be Countable and Traversable, | ||
- | echo RecordsToHtml([" | + | echo RecordsToList([" |
// Fine: | // Fine: | ||
- | echo RecordsToHtml(new ArrayObject([" | + | echo RecordsToList(new ArrayObject([" |
// Output: | // Output: | ||
// <ol> | // <ol> | ||
Line 43: | Line 43: | ||
</ | </ | ||
- | Note that if [[rfc: | + | Note that if [[rfc: |
<PHP> | <PHP> | ||
function RecordsToList(Array | (Countable & Traversable) $input): String { | function RecordsToList(Array | (Countable & Traversable) $input): String { | ||
Line 58: | Line 58: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | When union and intersection types are in the same expression they must be grouped with parenthesis (demonstrated above). The following is invalid: | ||
+ | |||
+ | <PHP> | ||
+ | function RecordsToList(Array | Countable & Traversable): | ||
+ | // ... | ||
+ | } | ||
+ | </ | ||
+ | |||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== |
rfc/intersection_types.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1