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

Remove deprecated library #556

Closed
wants to merge 1 commit into from

Conversation

toxicity1985
Copy link

@toxicity1985 toxicity1985 commented Mar 4, 2024

fix #443 #555

@toxicity1985 toxicity1985 changed the title Remove deprecated livrary Remove deprecated library Mar 4, 2024
@dbu
Copy link
Contributor

dbu commented Mar 4, 2024

thanks for the pull request. this will need quite some refactoring. we need to accept the PSR17 factories (in addition to the legacy factories for BC) in places like the (HttpDispatcher)[https://github.com/FriendsOfSymfony/FOSHttpCache/blob/e446b18c2fe80484684c67ebd1848ec726c8a4ad/src/ProxyClient/HttpDispatcher.php#L104] and use the psr17 discovery (but again for BC should fallback to the legacy discovery if not found)

the tests need to use the new discovery as well, it seems.

for the declared dependencies, i am not sure about removing them in version 2. if somebody instantiates something explicitly, it would break for them once they update.

if we allow the new things while still supporting the old, we can tag a last 2.x release and then start 3.x where we actually drop things and completely move to PSR-17.

if you have some time to work on this, it would be awesome!

@toxicity1985
Copy link
Author

Hello,
Yes, i was looking more deeper in the library but i don't find my way.
It's something complicated. I think that some other libray has to be updated but not sure about that.

@toxicity1985 toxicity1985 force-pushed the 3.x branch 2 times, most recently from 738dbd1 to 905340f Compare March 4, 2024 15:46
Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

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

thanks for looking into this!

@@ -52,7 +52,7 @@ class Cloudflare extends HttpProxyClient implements ClearCapable, PurgeCapable,
public function __construct(
Dispatcher $httpDispatcher,
array $options = [],
RequestFactory $messageFactory = null
RequestFactoryInterface $messageFactory = null
Copy link
Contributor

Choose a reason for hiding this comment

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

to avoid BC breaks, we should remove the type declaration and instead have a phpdoc that does RequestFactory|RequestFactoryInterface

* default one is created
*/
public function __construct(
array $servers,
$baseUri = '',
HttpAsyncClient $httpClient = null,
UriFactory $uriFactory = null
Psr17FactoryDiscovery $uriFactory = null,
Copy link
Contributor

Choose a reason for hiding this comment

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

and this needs a phpdoc UriFactory|Psr17FactoryDiscovery and our code needs to handle both cases


$this->setServers($servers);
$this->setBaseUri($baseUri);
}

public function invalidate(RequestInterface $invalidationRequest, $validateHost = true)
{
var_dump('ttttt');
Copy link
Contributor

Choose a reason for hiding this comment

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

don't forget to remove this when debugging is done

) {
$this->httpDispatcher = $httpDispatcher;
$this->options = $this->configureOptions()->resolve($options);
$this->requestFactory = $messageFactory ?: MessageFactoryDiscovery::find();
$this->requestFactory = $messageFactory ?: Psr17FactoryDiscovery::findRequestFactory();
Copy link
Contributor

Choose a reason for hiding this comment

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

we should fallback to MessageFactoryDiscovery::find if the Psr17FactoryDiscovery does not find anything.

@dbu
Copy link
Contributor

dbu commented Mar 28, 2024

wrapped up in #566

because we do a new major version, i decided to not provide BC with the old factories. anyways most legacy factories at the same time implement the psr factory as well.

@dbu dbu closed this Mar 28, 2024
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.

Switch from HTTPlug to PSR-17 and PSR-18
2 participants