Skip to content

Commit 40ea784

Browse files
authored
Separate chain calls (#80)
1 parent 1efa6f1 commit 40ea784

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ The following methods are available:
106106
## Inflector usage
107107

108108
```php
109-
echo (new \Yiisoft\Strings\Inflector())->withoutIntl()->toSlug('Strings are cool!'); // strings-are-cool
109+
echo (new \Yiisoft\Strings\Inflector())
110+
->withoutIntl()
111+
->toSlug('Strings are cool!'); // strings-are-cool
110112
```
111113

112114
Overall the inflector has the following method groups.
@@ -171,7 +173,9 @@ The following characters are special in the pattern:
171173
use \Yiisoft\Strings\WildcardPattern;
172174

173175
$startsWithTest = new WildcardPattern('test*');
174-
if ($startsWithTest->ignoreCase()->match('tEStIfThisIsTrue')) {
176+
if ($startsWithTest
177+
->ignoreCase()
178+
->match('tEStIfThisIsTrue')) {
175179
echo 'It starts with "test"!';
176180
}
177181
```

tests/InflectorTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ public function testToSlugCommons(string $input, string $expected, string $repla
212212
if (\extension_loaded('intl')) {
213213
$this->assertEquals($expected, $inflector->toSlug($input, $replacement));
214214
}
215-
$this->assertEquals($expected, $inflector->withoutIntl()->toSlug($input, $replacement));
215+
$this->assertEquals($expected, $inflector
216+
->withoutIntl()
217+
->toSlug($input, $replacement));
216218
}
217219

218220
public function testToSlugWithIntl(): void
@@ -403,13 +405,15 @@ public function testToTransliteratedWithTransliterationMap(): void
403405
$this->markTestSkipped('intl extension is required.');
404406
}
405407

406-
$inflector = (new Inflector())->withoutIntl()->withTransliterationMap(
407-
[
408-
'O' => 'E',
409-
'N' => 'N',
410-
'E' => 'O',
411-
]
412-
);
408+
$inflector = (new Inflector())
409+
->withoutIntl()
410+
->withTransliterationMap(
411+
[
412+
'O' => 'E',
413+
'N' => 'N',
414+
'E' => 'O',
415+
]
416+
);
413417
$this->assertEquals('ENO', $inflector->toTransliterated('ONE'));
414418
}
415419

0 commit comments

Comments
 (0)