Skip to content

Commit 52bd49b

Browse files
committed
cs fix
1 parent 00e3ba0 commit 52bd49b

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

src/Arrays.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static function firstValue(array $array)
5353
public static function columnAsKey(iterable $array, $column): array
5454
{
5555
$result = [];
56+
5657
foreach ($array as $values) {
5758
$result[$values[$column]] = $values;
5859
}

src/StringNormalizer.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,38 @@ final class StringNormalizer
77

88
/**
99
* @var string[]
10-
* @copyright https://stackoverflow.com/a/12824140
1110
*/
1211
private static array $emojiRegexes = [
13-
'\x{1F600}-\x{1F64F}', // emoticons,
14-
'\x{1F300}-\x{1F5FF}', // miscellaneous, pictographs
15-
'\x{1F680}-\x{1F6FF}', // transport, map symbols
16-
'\x{2600}-\x{26FF}', // miscellaneous
17-
'\x{2700}-\x{27BF}', // dingbats
12+
// emoticons,
13+
'\x{1F600}-\x{1F64F}',
14+
// miscellaneous, pictographs
15+
'\x{1F300}-\x{1F5FF}',
16+
// transport, map symbols
17+
'\x{1F680}-\x{1F6FF}',
18+
// miscellaneous
19+
'\x{2600}-\x{26FF}',
20+
// dingbats
21+
'\x{2700}-\x{27BF}',
1822
];
1923

2024
public static function normalizeSpaces(string $str): string
2125
{
22-
return preg_replace('# {2,}#', ' ', trim($str));
26+
return (string) preg_replace('# {2,}#', ' ', trim($str));
2327
}
2428

2529
public static function normalizeWhitespaces(string $str): string
2630
{
27-
$str = preg_replace('#[\r\n]+#', ' ', trim($str));
31+
$str = (string) preg_replace('#[\r\n]+#', ' ', trim($str));
2832

29-
return preg_replace('#\s{2,}#', ' ', $str);
33+
return (string) preg_replace('#\s{2,}#', ' ', $str);
3034
}
3135

3236
public static function normalizeEmoji(string $str): string
3337
{
34-
return trim(preg_replace(sprintf('#\s*[%s]+\s*#u', implode('', self::$emojiRegexes)), ' ', $str), ' ');
38+
return (string) trim(
39+
(string) preg_replace(sprintf('#\s*[%s]+\s*#u', implode('', self::$emojiRegexes)), ' ', $str),
40+
' '
41+
);
3542
}
3643

3744
}

tests/cases/arrays.columnAsKey.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ Assert::same([
1010
5 => ['id' => 5],
1111
6 => ['id' => 6],
1212
], Arrays::columnAsKey([
13-
['id' => 5], ['id' => 6],
13+
['id' => 5],
14+
['id' => 6],
1415
], 'id'));

0 commit comments

Comments
 (0)