Skip to content

Support for pure intersection type in generics #6649

@bastien-phi

Description

@bastien-phi

Feature request

It would be nice to be able to have something like this

class Foo {}
interface Bar {}

/**
 * @template TKey of Foo
 */
class Collection{}

/**
 * @template TKey of Foo&Bar
 * @extends Collection<TKey>
 */
class SubCollection extends Collection {}

Actually, I have the error PHPDoc tag @template TKey for class SubCollection with bound type Bar&Foo is not supported.

Is there a workaround for that ?

https://phpstan.org/r/24435d9c-ea4c-44ad-aa9c-54ee9e21c97e

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions