Skip to content

Add EnvelopeReturnTypeExtension for symfony/messenger #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

Merged
merged 3 commits into from
Apr 1, 2019

Conversation

enumag
Copy link
Contributor

@enumag enumag commented Mar 28, 2019

Closes #43

$envelope = new \Symfony\Component\Messenger\Envelope(new stdClass());

$test1 = $envelope->all(\Symfony\Component\Messenger\Stamp\ReceivedStamp::class);
$test2 = $envelope->all(random_bytes(1));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

any better way to pass a "non-constant-string" in this test?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this is fine.

): Type
{
if (count($methodCall->args) === 0) {
return new ArrayType(new MixedType(), new ArrayType(new MixedType(), new ObjectType(StampInterface::class)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

StampInterface needs to be a string here, so that composer require checker doesn't complain. I know, not ideal.


$argType = $scope->getType($methodCall->args[0]->value);
if (!$argType instanceof ConstantStringType) {
return new ArrayType(new MixedType(), new ObjectType(StampInterface::class));
Copy link
Collaborator

Choose a reason for hiding this comment

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

...and here...

@enumag
Copy link
Contributor Author

enumag commented Apr 1, 2019

@lookyman Fixed. In my opinion composer require checker should ignore ::class usages since they don't fail if the class/interface does not exist.

@lookyman
Copy link
Collaborator

lookyman commented Apr 1, 2019

@enumag Yes, I think so as well.

Some things are still failing, but I'll fix those. Thanks!

@lookyman lookyman merged commit 9c7e936 into phpstan:master Apr 1, 2019
@enumag
Copy link
Contributor Author

enumag commented Apr 1, 2019

@lookyman Thank you!

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.

2 participants