Skip to content

Commit 31b8720

Browse files
committed
return null when message with name is not set
1 parent f28e58e commit 31b8720

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function setMessage(string $message, string $name = 'message')
171171

172172
public function getMessage(string $name = 'message')
173173
{
174-
return $this->messages[$name];
174+
return $this->messages[$name] ?? null;
175175
}
176176

177177
public function getStartTime(): int

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,4 +1173,11 @@ public function testMultiLineFormatIsFullyCorrectlyWithManuallyCleanup()
11731173
stream_get_contents($output->getStream())
11741174
);
11751175
}
1176+
1177+
public function testGetNotSetMessage()
1178+
{
1179+
$progressBar = new ProgressBar($this->getOutputStream());
1180+
1181+
$this->assertNull($progressBar->getMessage());
1182+
}
11761183
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy