Skip to content

Add PHPStan Template #98

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

Merged
merged 1 commit into from
Feb 16, 2021
Merged

Conversation

marcelthole
Copy link
Contributor

Hi,

are you open for PHPStan specific Annotations?
The following PR will fix following use case:

$spec = cebe\openapi\Reader::readFromYamlFile($inputFile, cebe\openapi\spec\OpenApi::class);
// this is required because the method returns only a SpecObjectInterface as annotation
assert($spec instanceof cebe\openapi\spec\OpenApi);

With the @phpstan-template annotation, PHPStan knowns, that the second parameter defines the return type and the paramater must be a class string and an instanceof SpecObjectInterface.

This should help other people who uses PHPStan and your library.

If you are fine with this, i will try to add more PHPStan specific type hints. But first i wanted to know if you would support that annotations.

@cebe
Copy link
Owner

cebe commented Feb 16, 2021

Hi @marcelthole, thanks for the suggestion. I am fine with adding these.

@cebe cebe merged commit b33d45e into cebe:master Feb 16, 2021
@cebe
Copy link
Owner

cebe commented Feb 16, 2021

Thank you!

@cebe cebe added this to the 1.5.1 milestone Feb 16, 2021
@cebe cebe added the enhancement New feature or request label Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants