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

Migrate to Doctrine's fork of jdorn/sql-formatter #971

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Apr 28, 2020

Q A
Type improvement
BC Break no
Fixed issues #924

Summary

We like our dependencies maintained, and jdorn/sql-formatter sadly no
longer is. I am targeting master, because doctrine/sql-formatter requires php 7.2

public function __construct(Configuration $configuration, AbstractPlatform $platform)
{
$this->configuration = $configuration;
$this->platform = $platform;
$this->sqlFormatter = new SqlFormatter(new NullHighlighter());
Copy link
Member Author

@greg0ire greg0ire Apr 28, 2020

Choose a reason for hiding this comment

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

I hesitated to have a ctor argument for this, but then that would mean do some mocking in the test, and "Don't mock what you don't own" ™️
When I see this, I think it could be cool to have a named constructor like SqlFormatter::withoutHighlight(). This is still a nice improvement over having this false in the method call, it's more explicit.

@greg0ire greg0ire requested a review from goetas April 28, 2020 18:28
@greg0ire greg0ire force-pushed the migrate-to-doctrine-fork branch from f2db953 to 2bc2ea0 Compare April 28, 2020 18:30
public function __construct(Configuration $configuration, AbstractPlatform $platform)
{
$this->configuration = $configuration;
$this->platform = $platform;
$this->sqlFormatter = new SqlFormatter(new NullHighlighter());
Copy link
Member

Choose a reason for hiding this comment

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

creating the sql formatter should be done on generate when $formatted=true, having it in the constructor makes is a hard dependency

Copy link
Member

Choose a reason for hiding this comment

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

should we move the if (! class_exists(SqlFormatter::class)) { checks inside this class?

Copy link
Member Author

Choose a reason for hiding this comment

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

The exception talks about a CLI option, so I don't think we should.

We like our dependencies maintained, and jdorn/sql-formatter sadly no
longer is.
@greg0ire greg0ire force-pushed the migrate-to-doctrine-fork branch from 2bc2ea0 to 0eff8f8 Compare April 29, 2020 17:00
@greg0ire greg0ire requested a review from goetas April 29, 2020 17:01
@greg0ire greg0ire merged commit dbfc777 into doctrine:master Apr 29, 2020
@greg0ire greg0ire deleted the migrate-to-doctrine-fork branch April 29, 2020 18:49
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.

2 participants