Skip to content

Comments

use conditional return type for is_a() via stub#1310

Merged
ondrejmirtes merged 3 commits intophpstan:1.7.xfrom
staabm:is-a-stub
May 13, 2022
Merged

use conditional return type for is_a() via stub#1310
ondrejmirtes merged 3 commits intophpstan:1.7.xfrom
staabm:is-a-stub

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented May 13, 2022

<?php

/**
* @param mixed $object_or_class
Copy link
Contributor Author

Choose a reason for hiding this comment

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

couldn't we even use a conditional parameter type here?

Suggested change
* @param mixed $object_or_class
* @param ($allow_string is false ? object : object|class-string) $object_or_class

Copy link
Member

Choose a reason for hiding this comment

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

Try it after this PR is merged :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh my.. now I get what you was telling me in #1306 (comment) .. will send a 2nd PR ..

@staabm staabm changed the title use conditional parameter for is_a() via stub use conditional return type for is_a() via stub May 13, 2022
@ondrejmirtes ondrejmirtes merged commit 1f38c6c into phpstan:1.7.x May 13, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the is-a-stub branch May 13, 2022 13:52
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.

3 participants