Skip to content

Conversation

@CReimer
Copy link
Contributor

@CReimer CReimer commented Sep 29, 2025

Same as before. This time the branch is not locked 😄

Most of these changes are contradicting return types. PHP return type says MessageInterface vs. PHPDoc says Message. I switched everything around to the interface as it better aligns with the "user can override everything"-idea.

I changed the template tags of ResponseCollection around. I'm no expert in these, but bevore PHPStan had problems understanding the generic, with this change it works out-of-the box.

protected function assertTaggedResponse(string $tag, ?callable $exception = null): TaggedResponse
{
return $this->assertNextResponse(
/** @var TaggedResponse $response */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit unhappy with this one. Everything says It is "TaggedResponse", but the method signature of assertNextResponse is too complex for PHPStan to understand it directly. This way we do a type coercion and return it afterwards. I don't see a cleaner solution for this, without significantly changing how assert*Response works.

Copy link
Member

Choose a reason for hiding this comment

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

This is totally fine with me! 👍

Copy link
Member

@stevebauman stevebauman left a comment

Choose a reason for hiding this comment

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

Nice! This looks great, thanks! 🙏

protected function assertTaggedResponse(string $tag, ?callable $exception = null): TaggedResponse
{
return $this->assertNextResponse(
/** @var TaggedResponse $response */
Copy link
Member

Choose a reason for hiding this comment

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

This is totally fine with me! 👍

@stevebauman stevebauman merged commit eff902b into DirectoryTree:master Sep 29, 2025
8 checks passed
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