Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Psalm annotations for traits and their usages #103

Merged
merged 1 commit into from
Jun 16, 2022
Merged

fix Psalm annotations for traits and their usages #103

merged 1 commit into from
Jun 16, 2022

Conversation

someniatko
Copy link
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
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.

None yet

2 participants