Skip to content
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

Support Bus::dispatchChain #19

Merged
merged 3 commits into from
May 20, 2023

Conversation

joelvh
Copy link
Contributor

@joelvh joelvh commented May 10, 2023

This adds support for Bus::dispatchChain. This change introduces the idea that multiple classes can be resolved rather than a single class.

Tests are added for an array of jobs as an argument or assigned to a variable.

I've also removed the exception when an unsupported dispatch call is encountered in order to avoid exiting early.

See #8 for some discussion about this.


return $this->areClassesSame($variableClass, $subjectClass);
return count($variableClasses) === 1 && $this->areClassesSame($variableClasses[0], $subjectClass);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JonasPardon this is for backwards-compatibility, but you may have more context around the use cases here.

@@ -100,16 +107,21 @@ public function getMethodCalls(
throw new Exception('Static calls within method calls are not supported yet. If this is a Bus::chain, support is coming.');
}

throw new Exception('Not supported yet. Please open an issue here: https://github.com/JonasPardon/laravel-event-visualizer/issues/new');
// throw new Exception('Not supported yet. Please open an issue here: https://github.com/JonasPardon/laravel-event-visualizer/issues/new');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JonasPardon disabled this to avoid breaking this loop.

method: $node->name->toString(),
);
})->toArray();
return collect($this->resolveClassesFromArgument($node->args[0]))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JonasPardon there may be a cleaner way to do this.

@JonasPardon
Copy link
Owner

Hi @joelvh, this all looks good to me. Thanks for the contribution!

@JonasPardon JonasPardon merged commit 5a109ae into JonasPardon:main May 20, 2023
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