PHPGenerics / php-generics-rfc

Mirror of https://wiki.php.net/rfc/generics for easier collaboration
186 stars 1 forks source link

Resource Type #31

Closed orolyn closed 6 years ago

orolyn commented 6 years ago

There is no resource type hint, and I don't expect there to be one in the near future. How would one instantiate an instance where a type argument needs to be a resource?

morrisonlevi commented 6 years ago

I don't understand the use-case or issue; could you elaborate?

orolyn commented 6 years ago
class Foo<T>
{
    public function __construct(T $var)
    {
    }
}

new Foo<???>(fopen('myfile.txt', 'r'));
morrisonlevi commented 6 years ago

Maybe warn and use mixed?