Skip to content

Commit 9e5ce38

Browse files
committed
feat(strings): change signature of method increment
BREAKING CHANGES - signature of method `increment` changed.
1 parent 906b904 commit 9e5ce38

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Strings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,12 @@ public function random(int $length = 64, string $keyspace = '0123456789abcdefghi
321321
/**
322322
* Add's _1 to a string or increment the ending number to allow _2, _3, etc.
323323
*
324-
* @param int $first Start with
325324
* @param string $separator Separator
325+
* @param int $first Start with
326326
*
327327
* @return self Returns instance of The Strings class.
328328
*/
329-
public function increment(int $first = 1, string $separator = '_'): self
329+
public function increment(string $separator = '_', int $first = 1): self
330330
{
331331
preg_match('/(.+)' . $separator . '([0-9]+)$/', $this->string, $match);
332332

tests/StringsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676

7777
test('test increment() method', function (): void {
7878
$this->assertEquals('page_2', Strings::create('page_1')->increment());
79-
$this->assertEquals('page_3', Strings::create('page')->increment(3));
80-
$this->assertEquals('page-3', Strings::create('page')->increment(3, '-'));
79+
$this->assertEquals('page_3', Strings::create('page')->increment('_', 3));
80+
$this->assertEquals('page-3', Strings::create('page')->increment('-', 3));
8181
});
8282

8383

0 commit comments

Comments
 (0)