Skip to content

Add generic types for ObjectProphecy#574

Merged
stof merged 1 commit intophpspec:masterfrom
stof:generic_types
Nov 30, 2022
Merged

Add generic types for ObjectProphecy#574
stof merged 1 commit intophpspec:masterfrom
stof:generic_types

Conversation

@stof
Copy link
Copy Markdown
Member

@stof stof commented Nov 29, 2022

Closes #544

@stof stof merged commit d747835 into phpspec:master Nov 30, 2022
@stof stof deleted the generic_types branch November 30, 2022 09:23
* @return $this
*
* @template U
* @phpstan-param class-string<U> $class
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof should be $interface here, not $class

@ciaranmcnulty
Copy link
Copy Markdown
Member

This looks cool but without tests/validation I find it hard to review ;) If we merge it 'wrong' will it break things for anyone?

@Wirone
Copy link
Copy Markdown
Contributor

Wirone commented Nov 30, 2022

If one is using PHPStan with jangregor/phpstan-prophecy, it probably will have priority over "native" annotations within library. I'm not sure about scenario where PHPStan is used without this plugin and there are errors in the baseline - then it depends on reportUnmatchedIgnoredErrors flag. Even if it's enabled, then all that has to be done is regenerating baseline.

@stof
Copy link
Copy Markdown
Member Author

stof commented Nov 30, 2022

@Wirone the goal is that a next version of jangregor/phpstan-prophecy removes its stub to rely on the built-in annotations instead. The extension would only have to deal with the magic API.

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.

Feature Request: PHPDoc generics typehints

3 participants