-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Moved migration sorting from MigrationRepository to MigrationPlanCalculator #969
Conversation
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.
Thanks for the PR.
@riccardonar You can fix CS failures running vendor/bin/phpcs
.
lib/Doctrine/Migrations/Tools/Console/Command/DumpSchemaCommand.php
Outdated
Show resolved
Hide resolved
tests/Doctrine/Migrations/Tests/MigrationPlanCalculator/MigrationPlanCalculatorTest.php
Outdated
Show resolved
Hide resolved
tests/Doctrine/Migrations/Tests/MigrationPlanCalculator/Migrations/A/A.php
Outdated
Show resolved
Hide resolved
tests/Doctrine/Migrations/Tests/MigrationRepository/MigrationRepositoryTest.php
Outdated
Show resolved
Hide resolved
tests/Doctrine/Migrations/Tests/Version/MigrationPlanCalculatorTest.php
Outdated
Show resolved
Hide resolved
lib/Doctrine/Migrations/Version/SortedMigrationPlanCalculator.php
Outdated
Show resolved
Hide resolved
This pull request brings an interesting point. Are executed migrations sorted? if yes, how? using the same sorting for available migrations? if they are not sorted, |
Couldn't ExecutedMigrationsSet be sorted by the time it was recorded as executed on db? |
#974 will solve that |
…ulator This change will allow to define sorting by looking into the available migrations array. Before this change was not possible as the same object responsible for sorting migrations, was responsible also for locating migrations.
This is ready for review! |
*/ | ||
final class AvailableMigrationsSet implements Countable | ||
{ | ||
/** @var AvailableMigration[] */ |
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.
Since we have array_values
…
/** @var AvailableMigration[] */ | |
/** @var list<AvailableMigration> */ |
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.
Is this compatible with common IDEs ?
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.
It's compatible with vim :P
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.
Alternative suggested here:
/** @var AvailableMigration[] */ | |
/** | |
* @var AvailableMigration[] | |
* @phpstan-var AvailableMigration[] | |
* @psalm-var AvailableMigration[] | |
*/ |
Not that the second one is superflous: both tools read each other's annotations
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.
I personally do not like this "tool" specific annotations... if a third tool will emerge will need to add them too... i suggest to leave AvailableMigration[]
as it is
} | ||
|
||
/** | ||
* @return AvailableMigration[] |
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.
* @return AvailableMigration[] | |
* @return list<AvailableMigration> |
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.
Maybe we should discuss as a team what we want regarding annotations, anyway it's not a good reason to block this PR.
I'm merging this. The conversation about |
This change will allow to define sorting by looking into the available migrations array. Before this change was not possible as the same object responsible for sorting migrations, was responsible also for locating migrations (this the circular dependency..).