Skip to content

Commit 613b0e2

Browse files
authored
Add support for multiple new lines (#41638)
1 parent 097a364 commit 613b0e2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Illuminate/Support/Stringable.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ public function append(...$values)
6767
/**
6868
* Append a new line to the string.
6969
*
70+
* @param int $count
7071
* @return $this
7172
*/
72-
public function newLine()
73+
public function newLine($count = 1)
7374
{
74-
return $this->append(PHP_EOL);
75+
return $this->append(str_repeat(PHP_EOL, $count));
7576
}
7677

7778
/**

tests/Support/SupportStringableTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ public function testAscii()
422422
public function testNewLine()
423423
{
424424
$this->assertSame('Laravel'.PHP_EOL, (string) $this->stringable('Laravel')->newLine());
425+
$this->assertSame('foo'.PHP_EOL.PHP_EOL.'bar', (string) $this->stringable('foo')->newLine(2)->append('bar'));
425426
}
426427

427428
public function testAsciiWithSpecificLocale()

0 commit comments

Comments
 (0)