-
-
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
Migrate to Doctrine's fork of jdorn/sql-formatter #971
Conversation
public function __construct(Configuration $configuration, AbstractPlatform $platform) | ||
{ | ||
$this->configuration = $configuration; | ||
$this->platform = $platform; | ||
$this->sqlFormatter = new SqlFormatter(new NullHighlighter()); |
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 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.
f2db953
to
2bc2ea0
Compare
public function __construct(Configuration $configuration, AbstractPlatform $platform) | ||
{ | ||
$this->configuration = $configuration; | ||
$this->platform = $platform; | ||
$this->sqlFormatter = new SqlFormatter(new NullHighlighter()); |
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.
creating the sql formatter should be done on generate
when $formatted=true
, having it in the constructor makes is a hard dependency
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 we move the if (! class_exists(SqlFormatter::class)) {
checks inside this class?
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 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.
2bc2ea0
to
0eff8f8
Compare
Summary
We like our dependencies maintained, and
jdorn/sql-formatter
sadly nolonger is. I am targeting master, because
doctrine/sql-formatter
requires php 7.2