Skip to content

Commit 89a2627

Browse files
committed
fix trim
1 parent 42e68bb commit 89a2627

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Illuminate/Support/Stringable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public function substr($start, $length = null)
542542
*/
543543
public function trim($characters = null)
544544
{
545-
return new static(trim($this->value, $characters));
545+
return new static(trim(...array_merge([$this->value], func_get_args())));
546546
}
547547

548548
/**

tests/Support/SupportStringableTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ public function testMatch()
2424
$this->assertEquals(['un', 'ly'], $string->matchAll('/f(\w*)/')->all());
2525
$this->assertTrue($string->matchAll('/nothing/')->isEmpty());
2626
}
27+
28+
public function testTrim()
29+
{
30+
$string = new Stringable(' foo ');
31+
32+
$this->assertEquals('foo', (string) $string->trim());
33+
}
2734
}

0 commit comments

Comments
 (0)