Skip to content

Commit 559ad18

Browse files
Support ArgumentTypeDeclaration
1 parent 7880c1e commit 559ad18

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Inpsyde/Sniffs/CodeQuality/ArgumentTypeDeclarationSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function register()
4040
{
4141
// phpcs:enable Inpsyde.CodeQuality.ReturnTypeDeclaration
4242

43-
return [T_FUNCTION, T_CLOSURE];
43+
return [T_FUNCTION, T_CLOSURE, T_FN];
4444
}
4545

4646
/**

tests/fixtures/argument-type-declaration.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ function ()
129129

130130
}
131131

132+
fn() => true;
133+
134+
// @phpcsWarningOnNextLine
135+
fn($foo) => $foo*2;
136+
137+
fn(int $foo) => $foo*2;
138+
139+
// @phpcsWarningOnNextLine
140+
fn(int $foo, $bar) => true;
141+
142+
fn(int $foo, string $bar) => true;
143+
132144
// @phpcsWarningOnNextLine
133145
function ($foo)
134146
{

0 commit comments

Comments
 (0)