From 4658af4790b5d4381c0436706403ff87373c6b88 Mon Sep 17 00:00:00 2001 From: Richardas Kuchinskas Date: Fri, 16 Aug 2024 00:08:01 +0300 Subject: [PATCH] review fix --- src/linter/quickfix.go | 2 -- src/linter/report.go | 2 +- src/tests/checkers/nullable_types_test.go | 27 +++++++++++++++++++ .../testdata/quickfix/nullableTypes.php | 4 +-- .../quickfix/nullableTypes.php.fix.expected | 4 +-- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/linter/quickfix.go b/src/linter/quickfix.go index ae649ac4..05be888b 100644 --- a/src/linter/quickfix.go +++ b/src/linter/quickfix.go @@ -65,8 +65,6 @@ func (g *QuickFixGenerator) NullableType(param ir.Node) quickfix.TextEdit { EndPos: v.Position.EndPos, } value = v.Value - default: - panic("unexpected type") } return quickfix.TextEdit{ diff --git a/src/linter/report.go b/src/linter/report.go index 62996cee..9fb6a1c1 100644 --- a/src/linter/report.go +++ b/src/linter/report.go @@ -29,7 +29,7 @@ func addBuiltinCheckers(reg *CheckersRegistry) { Name: "nullableType", Default: true, Quickfix: true, - Comment: "Report not nullable string can be null.", + Comment: "Report not nullable param can be null.", Before: `function f(string $str = null);`, After: `function f(?string $str = null);`, }, diff --git a/src/tests/checkers/nullable_types_test.go b/src/tests/checkers/nullable_types_test.go index ce8b9162..ed73b729 100644 --- a/src/tests/checkers/nullable_types_test.go +++ b/src/tests/checkers/nullable_types_test.go @@ -97,3 +97,30 @@ class MyClass2 { } test.RunAndMatch() } + +func TestNullableMultipleArgs(t *testing.T) { + test := linttest.NewSuite(t) + test.AddFile(`