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

Use response factory #13

Closed
wants to merge 8 commits into from
Closed

Use response factory #13

wants to merge 8 commits into from

Conversation

MrHash
Copy link
Contributor

@MrHash MrHash commented Jun 30, 2020

Replaced explicit Zend Diactoros requirement with response factory. Updated tests to use mocks instead of any impl.

@MrHash
Copy link
Contributor Author

MrHash commented Jun 30, 2020

References #12

This was already the minimum through the transitive Diactoros
dependency.
Copy link
Owner

@franzliedke franzliedke left a comment

Choose a reason for hiding this comment

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

Thanks so much for tackling this! ❤️

I have a few things to discuss...

composer.json Outdated
@@ -9,7 +9,7 @@
},
"require": {
"filp/whoops": "^1.1 || ^2.0",
"zendframework/zend-diactoros": "^1.1.0 || ^2.0"
"middlewares/utils": "^3.0"
Copy link
Owner

Choose a reason for hiding this comment

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

This implicitly raises the (already implicit) minimu PHP version to 7.2, which I would like to avoid if possible. What alternatives are there for middlewares/utils?

Could I leave the discovery part completely to clients and simply require injecting a factory to the WhoopsRunner class?

(Please rebase the branch on top of the latest master, the build should start failing.)

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 think the point of the Factory is to be setup and global for a project. I think the utils 3.0 is required because of the mocks tbh so maybe by switching to diactoros in require-dev might offer the utils ^2.0 || ^3.0 version range.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another option is to explicitly statically set a ResponseFactoryInterface and StreamFactoryInterface from https://github.com/php-fig/http-factory to build a response. The only complete factory interface i know is from middlewares/utils but only from v3 on, which reintroduces that dependency.

Copy link
Owner

Choose a reason for hiding this comment

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

I want to sleep over this one. Thanks for explaining!

@MrHash
Copy link
Contributor Author

MrHash commented Jul 1, 2020

Reverted tests and switched to Laminas for dev mode since Zend is abandoned. Sorry the commits are a bit messy.

@franzliedke
Copy link
Owner

I extracted the relevant commit onto master now - went with PHP 7.2, as other dependencies hardly gave me a choice here. 😕

Thanks so much! This has been released as 2.0.

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