Skip to content

Commit e423cdd

Browse files
committed
tests: add one more tests case for Closure param signature
1 parent 89c07d5 commit e423cdd

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

tests/phar/data/absolute_1.out

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ Version main
44
-------------
55

66

7-
Parsing Foo\Foo total: 19 errors
8-
Parsing Models\LaravelModel total: 20 errors
9-
Parsing IPv4Address total: 20 errors
10-
Parsing MyContainer total: 22 errors
11-
Parsing Collection total: 22 errors
12-
Parsing DogCollection total: 22 errors
13-
Parsing PersistentCollection total: 22 errors
14-
Parsing Cat total: 22 errors
15-
Parsing Foo total: 22 errors
16-
Parsing Bar total: 22 errors
17-
Parsing SuperCoolLibrary\Meta total: 22 errors
18-
Parsing Net_Sample total: 24 errors
7+
Parsing Foo\Foo total: 21 errors
8+
Parsing Models\LaravelModel total: 22 errors
9+
Parsing IPv4Address total: 22 errors
10+
Parsing MyContainer total: 24 errors
11+
Parsing Collection total: 24 errors
12+
Parsing DogCollection total: 24 errors
13+
Parsing PersistentCollection total: 24 errors
14+
Parsing Cat total: 24 errors
15+
Parsing Foo total: 24 errors
16+
Parsing Bar total: 24 errors
17+
Parsing SuperCoolLibrary\Meta total: 24 errors
18+
Parsing Net_Sample total: 26 errors
1919
Parsing done
2020

2121
Rendering Global index.html

tests/phar/data/relative_1.out

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ Version main
44
-------------
55

66

7-
Parsing Foo\Foo total: 19 errors
8-
Parsing Models\LaravelModel total: 20 errors
9-
Parsing IPv4Address total: 20 errors
10-
Parsing MyContainer total: 22 errors
11-
Parsing Collection total: 22 errors
12-
Parsing DogCollection total: 22 errors
13-
Parsing PersistentCollection total: 22 errors
14-
Parsing Cat total: 22 errors
15-
Parsing Foo total: 22 errors
16-
Parsing Bar total: 22 errors
17-
Parsing SuperCoolLibrary\Meta total: 22 errors
18-
Parsing Net_Sample total: 24 errors
7+
Parsing Foo\Foo total: 21 errors
8+
Parsing Models\LaravelModel total: 22 errors
9+
Parsing IPv4Address total: 22 errors
10+
Parsing MyContainer total: 24 errors
11+
Parsing Collection total: 24 errors
12+
Parsing DogCollection total: 24 errors
13+
Parsing PersistentCollection total: 24 errors
14+
Parsing Cat total: 24 errors
15+
Parsing Foo total: 24 errors
16+
Parsing Bar total: 24 errors
17+
Parsing SuperCoolLibrary\Meta total: 24 errors
18+
Parsing Net_Sample total: 26 errors
1919
Parsing done
2020

2121
Rendering Global index.html

tests/phar/data/src/ElloquentBuilder.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ public function firstOrFail($columns = ['*']);
132132
*/
133133
public function firstOr($columns = ['*'], \Closure $callback = null);
134134

135+
/**
136+
* Execute the query and get the first result or call a callback.
137+
*
138+
* @param \Closure|array<int, (string|'*')> $columns
139+
* @param \Closure|null $callback
140+
* @phpstan-return TModelClass|mixed
141+
*/
142+
public function firstOr2($columns = ['*'], \Closure $callback = null);
143+
135144
/**
136145
* Add a basic where clause to the query.
137146
*

tests/phar/data/src/Foo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
namespace Foo;
44

5+
use Closure;
56

67
class Foo
78
{
9+
/**
10+
* @param Closure(string...):void $fn
11+
* @return void
12+
*/
13+
function expects_void_variadic(Closure $fn): void {
14+
}
815
}
16+
$f = new Foo();
17+
$f->expects_void_variadic(static function (string ...$a) {
18+
});

0 commit comments

Comments
 (0)