Skip to content

Don't remove abstract plugins #247

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 1 commit into from
Jan 8, 2018
Merged

Don't remove abstract plugins #247

merged 1 commit into from
Jan 8, 2018

Conversation

ostrolucky
Copy link
Collaborator

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #244
License MIT

These abstract definitions are needed for client plugin definitions, even if plugins weren't configured at root level.

Allows to configure plugin this way

httplug:
    clients:
        test:
            plugins:
                - cache:
                    cache_pool: my_cache_pool

instead of forcing unneeded configuration at httplug.plugins.cache level. See linked issue.

These abstract definitions are needed for client plugin definitions,
even if plugins weren't configured at root level.

Removal of unused abstract definitions is job of DI container.
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.

thanks for this. i think its fine to just leave the abstract definition in - the container is cleaned up by symfony anyways, and abstract definitions should not pose any problem. much less complicated than having to figure out for each abstract plugin if we need it somewhere or not.


/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage The child node "cache_pool" at path "httplug.clients.test.plugins.0.cache" must be configured.
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use $this->expectException and $this->expectExceptionMessage instead of the annotations. the annotations have been deprecated in favor of the method. they have the upsides of being able to use the ::class constant and (not relevant in this case here) of only accepting the exception at the place you actually expect it, not before that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no instance in this code base where expectExceptionMessage is used. I've followed style of existing code.

Furthermore, expectException is PHPUnit 6+ only.

If you decided to change the code style, please do it yourself with refactoring commit which replaces it in all places at once.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, my bad. i am working in too many repositories that are at different states of upgrading those things... indeed, its better to be consistent with this. i created #248


/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage The child node "cache_pool" at path "httplug.plugins.cache" must be configured.
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

@dbu
Copy link
Collaborator

dbu commented Jan 8, 2018

I think this is ready to merge. @Nyholm @fbourigault do you agree with this change?

@fbourigault fbourigault merged commit f034b16 into php-http:master Jan 8, 2018
@fbourigault
Copy link
Contributor

Thank you!

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.

Cannot define cache pool on per-client basis without configuring dummy cache plugin
3 participants