Skip to content

Instantly share code, notes, and snippets.

@morrisonlevi
Last active April 25, 2016 23:32
Show Gist options
  • Save morrisonlevi/d474dd159f2e6280bf16be81a4d2f199 to your computer and use it in GitHub Desktop.
Save morrisonlevi/d474dd159f2e6280bf16be81a4d2f199 to your computer and use it in GitHub Desktop.
Draft of email to PHP Internals

Internals,

Joe Watkins and Bob Weinand have worked out a proof-of-concept patch for union types. Please go download it and experiment with it.

A few things to note:

  • This patch includes intersection types. However, a type expression must be either a union type or an intersection type; it doesn't support both such as Array | (Countable & Traversable).
  • This patch adds null, true and false for type declarations.
  • This patch includes conversion rules for weak types.
  • It does not have short-hand for unions with null (?Foo being Foo | Null)

These features (or omitted ones) are not necessarily what will be voted on. Rather this patch allows us to experiment with these features in code. This experience should be helpful for us to solidify how we actually feel about these features.

I especially would like people to try out the conversion rules for scalar types as it has been a point of discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment