Skip to content

Commit 006bc71

Browse files
committed
Use arrow function syntax
1 parent 3550f18 commit 006bc71

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/Serializer.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,13 @@ private static function serializeString(string $value): string
209209

210210
private static function serializeDisplayString(DisplayString $value): string
211211
{
212-
$encodePattern = '/[%"\x00-\x1F\x7F-\xFF]/';
213-
$encodeCallback = function ($matches) {
214-
return strtolower(rawurlencode($matches[0]));
215-
};
216-
217-
return '%"' . preg_replace_callback($encodePattern, $encodeCallback, (string) $value) . '"';
212+
return '%"'
213+
. preg_replace_callback(
214+
'/[%"\x00-\x1F\x7F-\xFF]/',
215+
fn($matches) => strtolower(rawurlencode($matches[0])),
216+
(string) $value
217+
)
218+
. '"';
218219
}
219220

220221
private static function serializeToken(Token $value): string

tests/ParsingRulesetTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ public static function parseRulesetDataProvider(): array
1515
{
1616
return array_filter(
1717
static::rulesetDataProvider(),
18-
function ($params) {
19-
return !empty($params[0]->raw);
20-
}
18+
fn($params) => !empty($params[0]->raw)
2119
);
2220
}
2321

tests/SerializingRulesetTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ public static function serializeRulesetDataProvider(): array
1515
{
1616
return array_filter(
1717
static::rulesetDataProvider(),
18-
function ($params) {
19-
return !empty($params[0]->expected);
20-
}
18+
fn($params) => !empty($params[0]->expected)
2119
);
2220
}
2321

0 commit comments

Comments
 (0)