[RFC] Union Types

From: Date: Thu, 14 Apr 2016 03:46:51 +0000
Subject: [RFC] Union Types
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
As alluded to in an earlier email today[1] I am now moving the Union
Types RFC[2] to the discussion phase. The short summary of the RFC is
that it permits a type declaration to be one of several enumerated
types. For example, this is a potential signature for a multi-type map
routine:

    function map(callable $f, Array | Traversable $iterable);

The second parameter $iterable is required to be of type Array or
Traversable - any other type will error.

I look forward to a helpful and meaningful discussion!

  [1]: http://news.php.net/php.internals/92252
  [2]: https://wiki.php.net/rfc/union_types


Thread (14 messages)

« previous php.internals (#92274) next »