Skip to content

Commit bc13cbd

Browse files
authored
Merge pull request #145 from samsonasik/enable-cs
Rolback // phpcs:enable and add return type declaration on ArrowFunction and Closure
2 parents 6d61b6c + 2bc73be commit bc13cbd

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/UndisclosedPassword.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ final class UndisclosedPassword extends AbstractValidator
3939
self::NOT_A_STRING => 'The provided password is not a string, please provide a correct password',
4040
];
4141

42+
// phpcs:enable
4243
private ClientInterface $httpClient;
4344

4445
private RequestFactoryInterface $makeHttpRequest;

test/CallbackTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testCanAcceptContextWithoutOptions(): void
9090
{
9191
$value = 'bar';
9292
$context = ['foo' => 'bar', 'bar' => 'baz'];
93-
$validator = new Callback(static fn($v, $c) => ($value === $v) && ($context === $c));
93+
$validator = new Callback(static fn($v, $c): bool => ($value === $v) && ($context === $c));
9494
$this->assertTrue($validator->isValid($value, $context));
9595
}
9696

@@ -100,7 +100,7 @@ public function testCanAcceptContextWithOptions(): void
100100
$context = ['foo' => 'bar', 'bar' => 'baz'];
101101
$options = ['baz' => 'bat'];
102102
$validator = new Callback(
103-
static fn($v, $c, $baz) => ($value === $v)
103+
static fn($v, $c, $baz): bool => ($value === $v)
104104
&& ($context === $c) && ($options['baz'] === $baz)
105105
);
106106
$validator->setCallbackOptions($options);

test/TestAsset/Uri/Uri.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ public static function encodeUserInfo($userInfo)
10161016

10171017
$regex = '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:]|%(?![A-Fa-f0-9]{2}))/';
10181018
$escaper = static::getEscaper();
1019-
$replace = static fn($match) => $escaper->escapeUrl($match[0]);
1019+
$replace = static fn($match): string => $escaper->escapeUrl($match[0]);
10201020

10211021
return preg_replace_callback($regex, $replace, $userInfo);
10221022
}
@@ -1042,7 +1042,7 @@ public static function encodePath($path)
10421042

10431043
$regex = '/(?:[^' . self::CHAR_UNRESERVED . ')(:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/';
10441044
$escaper = static::getEscaper();
1045-
$replace = static fn($match) => $escaper->escapeUrl($match[0]);
1045+
$replace = static fn($match): string => $escaper->escapeUrl($match[0]);
10461046

10471047
return preg_replace_callback($regex, $replace, $path);
10481048
}
@@ -1069,7 +1069,7 @@ public static function encodeQueryFragment($input)
10691069

10701070
$regex = '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/';
10711071
$escaper = static::getEscaper();
1072-
$replace = static fn($match) => $escaper->escapeUrl($match[0]);
1072+
$replace = static fn($match): string => $escaper->escapeUrl($match[0]);
10731073

10741074
return preg_replace_callback($regex, $replace, $input);
10751075
}
@@ -1381,7 +1381,7 @@ protected static function normalizeFragment($fragment)
13811381
*/
13821382
protected static function decodeUrlEncodedChars($input, $allowed = '')
13831383
{
1384-
$decodeCb = static function ($match) use ($allowed) {
1384+
$decodeCb = static function ($match) use ($allowed): string {
13851385
$char = rawurldecode($match[0]);
13861386
if (preg_match($allowed, $char)) {
13871387
return $char;

test/ValidatorChainTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ public function getValidatorFalse()
232232
public function testCanAttachMultipleValidatorsOfTheSameTypeAsDiscreteInstances(): void
233233
{
234234
$this->validator->attachByName('Callback', [
235-
'callback' => static fn($value) => true,
235+
'callback' => static fn($value): bool => true,
236236
'messages' => [
237237
'callbackValue' => 'This should not be seen in the messages',
238238
],
239239
]);
240240
$this->validator->attachByName('Callback', [
241-
'callback' => static fn($value) => false,
241+
'callback' => static fn($value): bool => false,
242242
'messages' => [
243243
'callbackValue' => 'Second callback trapped',
244244
],

0 commit comments

Comments
 (0)