Skip to content

fix Psalm annotations for traits and their usages#103

Merged
rtheunissen merged 1 commit intophp-ds:masterfrom
someniatko:psalm-traits
Jun 16, 2022
Merged

fix Psalm annotations for traits and their usages#103
rtheunissen merged 1 commit intophp-ds:masterfrom
someniatko:psalm-traits

Conversation

@someniatko
Copy link
Copy Markdown
Contributor

@someniatko someniatko commented Jun 13, 2022

I found that I have problems with validating such code via psalm:

class Container
{
    /** @param Sequence<string> $strings */
    public function __construct(Sequence $strings) {}
}

new Container(new Vector());

It's because __construct() of the Vector is described in GenericSequence trait which is typed incorrectly: generic types are only defined in interfaces, but not in traits. This PR fixes that, adds @template-use annotations to trait clients, and also removes meaningless @inheritDoc annotation from GenericSequence, which by the way was not used in GenericCollection (traits have no inheritance tree).

@someniatko
Copy link
Copy Markdown
Contributor Author

added forgotten template-use to Deque in the force push

@rtheunissen rtheunissen merged commit a41ae6f into php-ds:master Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants