-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
Mark classes as internal that nobody should be depending on. #711
Conversation
254d29a
to
84eb10d
Compare
@@ -4,6 +4,9 @@ | |||
|
|||
namespace Doctrine\Migrations\Configuration; | |||
|
|||
/** | |||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jwage should these configuration classes really be internal ? How are they used then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't get used directly, they are a part of the internals of the console commands but are never used directly. They produce a Configuration
instance that then gets used in the console commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these classes actually be extending Configuration then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof arguably no, they should not. A better design would be to inject the Configuration in to ArrayConfiguration, etc. and then call the public getters on Configuration and have no inheritance at all. I could try tackling that refactoring in another PR.
lib/Doctrine/Migrations/Events.php
Outdated
@@ -4,6 +4,9 @@ | |||
|
|||
namespace Doctrine\Migrations; | |||
|
|||
/** | |||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this must not be internal. The events are extension points of the library, so the event names need to be public (otherwise they are not usable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing.
@@ -4,6 +4,9 @@ | |||
|
|||
namespace Doctrine\Migrations\Finder; | |||
|
|||
/** | |||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these meant to be an extension point of the library ? Otherwise, how would people choose a different finder ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this shouldn't be internal. Changing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implementations should not be internal either. Otherwise, the only way to use the extension point is to write your own implementation from scratch, even if you want the same behavior than one of the built-in implementations (as you cannot use them due to being internal and so not covered by BC).
@@ -15,6 +15,9 @@ | |||
use function rtrim; | |||
use function sprintf; | |||
|
|||
/** | |||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console helpers should not be internal either, as they must be registered in the CLI Application too (cli-config.php
is expected to instantiate a HelperSet with the appropriate helpers in it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I am not sure why this is a symfony console helper. It should not be. It is only used directly here as an internal dependency
$directoryHelper = new MigrationDirectoryHelper($this->configuration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, this one should not be a console helper then. But other console helpers should not be internal.
@@ -6,6 +6,9 @@ | |||
|
|||
use Doctrine\DBAL\Schema\Schema; | |||
|
|||
/** | |||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this meant to be an extension point ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, only SchemaProviderInterface
is an extension point that can be passed through here https://github.com/doctrine/migrations/blob/master/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php
I think the interface might have been created to ease unit testing whenever it was added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the interface has been added because the lazy one is implemented through decoration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. So I think this should not be public still, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this one is OK. I confused it with SchemaProviderInterface
@@ -10,6 +10,9 @@ | |||
use UnexpectedValueException; | |||
use function count; | |||
|
|||
/** | |||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be internal. ORM users should be able to use this implementation of the non-internal SchemaProviderInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets used internally here. I don't think it should be public https://github.com/doctrine/migrations/blob/master/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php#L136
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they don't provide their own schema provider that implements the SchemaProviderInterface
then it uses the OrmSchemaProvider.
@jwage was It seems like it shouldn't have, as |
@sserbin the implementation has been rightfully marked as |
Summary
Mark classes as internal that nobody should be depending on. The only thing I see that people should be depending on are: