Skip to content

Commit 85d34f1

Browse files
committed
add regression test for nullable parameter types
1 parent f9bb430 commit 85d34f1

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

tests/SearcherTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,14 @@ public function it_can_handle_chained_static_and_regular_calls()
289289

290290
$this->assertMatchesSnapshot($results->results);
291291
}
292+
293+
/** @test */
294+
public function it_can_handle_nullable_parameters()
295+
{
296+
$results = $this->getSearcher()
297+
->functions(['testFive'])
298+
->search(tests_path('data/file5.php'));
299+
300+
$this->assertMatchesSnapshot($results->results);
301+
}
292302
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-
2+
location: { column: 0, endLine: 6, startLine: 3 }
3+
node: { args: [{ type: Param, default: null, location: { column: 0, endLine: 3, startLine: 3 }, name: one }], name: testFive, location: { column: 0, endLine: 6, startLine: 3 } }
4+
snippet: null

tests/data/file5.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function testFive(?string $one)
4+
{
5+
return 'one';
6+
}

0 commit comments

Comments
 (0)