Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

add generics #1

Open
olivernybroe opened this issue Sep 11, 2019 · 0 comments
Open

add generics #1

olivernybroe opened this issue Sep 11, 2019 · 0 comments
Labels
rfc New proposal

Comments

@olivernybroe
Copy link

Having generics could be really cool.

A proposed syntax taken from a RFC to php.

class Entry<KeyType, ValueType>
{
    protected $key;
    protected $value;
 
    public function __construct(KeyType $key, ValueType $value)
    {
        $this->key   = $key;
        $this->value = $value;
    }
 
    public function getKey(): KeyType
    {
        return $this->key;
    }
 
    public function getValue(): ValueType
    {
        return $this->value;
    }
}
@nunomaduro nunomaduro added the rfc New proposal label Sep 11, 2019
@nunomaduro nunomaduro changed the title [RFC] Add generics add generics Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
rfc New proposal
Projects
None yet
Development

No branches or pull requests

2 participants