-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Console table cleanup #19406
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
Console table cleanup #19406
Changes from 6 commits
e7991ae
993a77f
c3647ec
db2010c
f1e68d0
04283ac
99fe32b
9b2e4d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -694,6 +694,25 @@ public function testColumnWiths() | |
$this->assertEquals($expected, $this->getOutputContent($output)); | ||
} | ||
|
||
/** | ||
* @expectedException \InvalidArgumentException | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. \Symfony\Component\Console\Exception\InvalidArgumentException |
||
* @expectedExceptionMessage Style "absent" is not defined. | ||
*/ | ||
public function testIsNotDefinedStyleException() | ||
{ | ||
$table = new Table($this->getOutputStream()); | ||
$table->setStyle('absent'); | ||
} | ||
|
||
/** | ||
* @expectedException \InvalidArgumentException | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. \Symfony\Component\Console\Exception\InvalidArgumentException There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
* @expectedExceptionMessage Style "absent" is not defined. | ||
*/ | ||
public function testGetStyleDefinition() | ||
{ | ||
Table::getStyleDefinition('absent'); | ||
} | ||
|
||
protected function getOutputStream() | ||
{ | ||
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false); | ||
|
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.
Why not using
isset()
here?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.
By my suggestion: using isset would be written as:
if (isset(self::$styles[$name]) && !self::$styles[$name]) {
which happens to be exactly what
empty()
does.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.
When can the style be falsy?
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 don't know :)
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.
Reading the code, it looks like it is defined with an object or not defined at all. So, I think we should keep
isset()
as before in the newresolveStyle()
method and change this one to useisset()
as well. Whenever possible, I tend to avoid usingempty()
.Uh oh!
There was an error while loading. Please reload this page.
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.
@fabpot, before little change - what prefer?
1
or
2:
As for me is
2
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.
Ok for 2
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.
Done