Skip to content

Add a custom expression resolver for type specification #44

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

Closed
nesk opened this issue Mar 27, 2019 · 3 comments
Closed

Add a custom expression resolver for type specification #44

nesk opened this issue Mar 27, 2019 · 3 comments

Comments

@nesk
Copy link

nesk commented Mar 27, 2019

I've create some assertion methods, including those:

assertResponseIsRedirect(Response $response, string $message = ''): void
assertRedirectResponseIsPermanent(RedirectResponse $response, string $message = ''): void

If I create a functional test making a request with Symfony, I want to check if the response is a redirect (with instanceof in my assertion method) and then I want to check if the redirection is permanent:

$response = $this->client->getResponse();
self::assertResponseIsRedirect($response);
self::assertRedirectResponseIsPermanent($response);

If I run PHPStan, I get the following error:

Parameter #1 $response of static method Path\To\TestCase::assertRedirectResponseIsPermanent() expects Symfony\Component\HttpFoundation\RedirectResponse, Symfony\Component\HttpFoundation\Response given.

Is there any way to add a custom expression resolver to AssertTypeSpecifyingExtensionHelper so I can get rid of this error?

@ondrejmirtes
Copy link
Member

ondrejmirtes commented Mar 27, 2019 via email

@nesk
Copy link
Author

nesk commented Mar 28, 2019

Great, thank you! 🙂

@nesk nesk closed this as completed Mar 28, 2019
@github-actions
Copy link

github-actions bot commented May 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants