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

Split and move around exceptions, make MigrationException an interface #636

Merged
merged 1 commit into from
May 6, 2018

Conversation

Majkl578
Copy link
Contributor

@Majkl578 Majkl578 commented May 6, 2018

  • root MigrationException is now an interface
  • factory methods from MigrationException extracted to specialized exceptions
  • exceptions from root moved to Exception sub-namespace
  • all exceptions are now final
  • all exceptions now implement MigrationException (directly or indirectly) and extending SPL exceptions

This follows concept introduced in ORM (doctrine/orm#6743 + doctrine/orm#7210) and naming follows pattern accepted in Doctrine CS.

No polyfill is currently provided in this PR, it should be introduced in 1.x afterwards.

closes #621

cc @greg0ire

@Majkl578 Majkl578 added this to the 2.0 milestone May 6, 2018
@Majkl578 Majkl578 requested review from jwage, alcaeus and mikeSimonson May 6, 2018 02:19
@Majkl578 Majkl578 requested a review from lcobucci May 6, 2018 02:29
'Migrations configuration file already loaded'
),
8
);
Copy link
Member

Choose a reason for hiding this comment

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

You only really need to linebreak either self or sprintf, not both

Copy link
Member

Choose a reason for hiding this comment

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

BTW, why the sprintf?

sprintf(
'Migrations configuration file already loaded'
),
8
Copy link
Member

Choose a reason for hiding this comment

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

What are those codes about? Do you think people might rely on them? Should they be documented somewhere?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see, they were there before, let's keep them then, I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You will have to ask someone else for that. :P 5d6fbf8
Just kept those for compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OF course, with this new exception layout it's obsolete.

sprintf(
'Migration class "%s" contains a prepared statement.
Unfortunately there is no cross platform way of outputing it as an sql string.
Do you want to write a PR for it ?',
Copy link
Member

Choose a reason for hiding this comment

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

Haha that's great 😂

Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

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

@Majkl578 great job, just this tiny little thing 😄

public static function new() : self
{
return new self(
sprintf(
Copy link
Member

Choose a reason for hiding this comment

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

sprintf() here is not really needed

@Majkl578
Copy link
Contributor Author

Majkl578 commented May 6, 2018

I further split Doctrine\Migrations\Configuration\Exception\NotValid to specific ones and removed it.

@jwage
Copy link
Member

jwage commented May 6, 2018

Ready to merge?

@Majkl578
Copy link
Contributor Author

Majkl578 commented May 6, 2018

Still wanted @alcaeus to have a look. 😊 But if you need it in for some other work, could be discussed after merge.

@Majkl578
Copy link
Contributor Author

Majkl578 commented May 6, 2018

Hmm, I alegedly decreased coverage by 1% just by moving around the methods and it's now blocking merge. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split up monster MigrationException in to smaller exceptions
4 participants