Skip to content

Add PHPStan Template#98

Merged
cebe merged 1 commit intocebe:masterfrom
marcelthole:use-phpstan-typehints
Feb 16, 2021
Merged

Add PHPStan Template#98
cebe merged 1 commit intocebe:masterfrom
marcelthole:use-phpstan-typehints

Conversation

@marcelthole
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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