Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Console] Display console application name even when no version set
  • Loading branch information
polc committed Jan 10, 2016
commit 4753a2d0f36e3adaa671d30cf0101f766561ff2b
2 changes: 2 additions & 0 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ public function getLongVersion()
{
if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) {
return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
} else if ('UNKNOWN' !== $this->getName()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

else is not required here.

return sprintf('<info>%s</info>', $this->getName());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

More clear would be IMO:

if ('UNKNOWN' !== $this->getName()) {
    if ('UNKNOWN' !== $this->getVersion()) {
        return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
    }

    return sprintf('<info>%s</info>', $this->getName());
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's what I had done at first but I thought I was less clear. Anyway I can change no problems !


return '<info>Console Tool</info>';
Expand Down