Skip to content

Add Symfony 4 support #228

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
Nov 29, 2017
Merged

Add Symfony 4 support #228

merged 3 commits into from
Nov 29, 2017

Conversation

fbourigault
Copy link
Contributor

@fbourigault fbourigault commented Nov 28, 2017

This is #211 with a hack to get services private in Symfony 4 without rewriting a large part of tests.

I fixedup @dbrumann commits and added mine to get @dbrumann credited.

Close #211. Close #218.

The PublicServicesForFunctionalTestsPass is a hack and we must rewrite tests to remove this in the future.

@fbourigault fbourigault changed the title Feature/symfony4 Add Symfony 4 support Nov 28, 2017
@@ -297,6 +298,7 @@ private function configureClient(ContainerBuilder $container, $clientName, array

$container
->register($serviceId, PluginClient::class)
->setPublic(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

How can we avoid to set this one public just for tests?

Copy link
Member

Choose a reason for hiding this comment

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

Psudo code:

$services = $container->getAllServiceDefinitionKeys()
foreach ($services as $service) {
  if ($service->getId() matches "httplug.client.*") {
    $container->getDefinition($service)->setPublic(true);
  }
}

I do not know any better... sorry

Copy link
Member

Choose a reason for hiding this comment

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

Btw, will the tests fail if we remove this line?

Copy link
Collaborator

Choose a reason for hiding this comment

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

if we keep the compiler pass, this line can be reverted, right?

Copy link
Collaborator

@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.

i am not perfectly happy with this. but if there is no simple way to test on the container builder instead, i'd say lets merge this

];
foreach ($services as $service) {
if ($container->hasDefinition($service)) {
$container->getDefinition($service)->setPublic(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this could be quite confusing when reading the tests, or when creating a new test. is there any chance we can instead have our tests operate on the container builder instead of the closed container?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the idea but it's too many work ATM.

@@ -297,6 +298,7 @@ private function configureClient(ContainerBuilder $container, $clientName, array

$container
->register($serviceId, PluginClient::class)
->setPublic(true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we keep the compiler pass, this line can be reverted, right?

@fbourigault
Copy link
Contributor Author

This version looks really fine to me. @dbu @Nyholm what do you think?

@fbourigault fbourigault added this to the 1.8.0 milestone Nov 29, 2017
Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Make sure to merge with with a merge commit

@fbourigault
Copy link
Contributor Author

fbourigault commented Nov 29, 2017

We are still waiting for matthiasnoback/symfony-dependency-injection-test and php-http/stopwatch-plugin to really test against Symfony 4 only components.

@@ -50,7 +51,7 @@ public function load(array $configs, ContainerBuilder $container)

// Set main aliases
foreach ($config['main_alias'] as $type => $id) {
$container->setAlias(sprintf('httplug.%s', $type), $id);
$container->setAlias(sprintf('httplug.%s', $type), new Alias($id, true));
Copy link
Member

Choose a reason for hiding this comment

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

the changes in this file should then be reverted too

@fbourigault
Copy link
Contributor Author

I removed the public aliases.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you

@Nyholm Nyholm merged commit 66ed979 into php-http:master Nov 29, 2017
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.

should autodiscovered clients be public or private?
4 participants