@@ -25,15 +25,12 @@ class TemplateTypeTest extends PHPStanTestCase
25
25
26
26
public function dataAccepts (): array
27
27
{
28
- $ templateType = static function (string $ name , ?Type $ bound , ?string $ functionName = null ): Type {
29
- /** @var non-empty-string $name */
30
- return TemplateTypeFactory::create (
31
- TemplateTypeScope::createWithFunction ($ functionName ?? '_ ' ),
32
- $ name ,
33
- $ bound ,
34
- TemplateTypeVariance::createInvariant (),
35
- );
36
- };
28
+ $ templateType = static fn ($ name , ?Type $ bound , ?string $ functionName = null ): Type => TemplateTypeFactory::create (
29
+ TemplateTypeScope::createWithFunction ($ functionName ?? '_ ' ),
30
+ $ name ,
31
+ $ bound ,
32
+ TemplateTypeVariance::createInvariant (),
33
+ );
37
34
38
35
return [
39
36
0 => [
@@ -130,15 +127,12 @@ public function testAccepts(
130
127
131
128
public function dataIsSuperTypeOf (): array
132
129
{
133
- $ templateType = static function (string $ name , ?Type $ bound , ?string $ functionName = null ): Type {
134
- /** @var non-empty-string $name */
135
- return TemplateTypeFactory::create (
136
- TemplateTypeScope::createWithFunction ($ functionName ?? '_ ' ),
137
- $ name ,
138
- $ bound ,
139
- TemplateTypeVariance::createInvariant (),
140
- );
141
- };
130
+ $ templateType = static fn ($ name , ?Type $ bound , ?string $ functionName = null ): Type => TemplateTypeFactory::create (
131
+ TemplateTypeScope::createWithFunction ($ functionName ?? '_ ' ),
132
+ $ name ,
133
+ $ bound ,
134
+ TemplateTypeVariance::createInvariant (),
135
+ );
142
136
143
137
return [
144
138
0 => [
@@ -321,15 +315,12 @@ public function testIsSuperTypeOf(
321
315
/** @return array<string,array{Type,Type,array<string,string>}> */
322
316
public function dataInferTemplateTypes (): array
323
317
{
324
- $ templateType = static function (string $ name , ?Type $ bound = null , ?string $ functionName = null ): Type {
325
- /** @var non-empty-string $name */
326
- return TemplateTypeFactory::create (
327
- TemplateTypeScope::createWithFunction ($ functionName ?? '_ ' ),
328
- $ name ,
329
- $ bound ,
330
- TemplateTypeVariance::createInvariant (),
331
- );
332
- };
318
+ $ templateType = static fn ($ name , ?Type $ bound = null , ?string $ functionName = null ): Type => TemplateTypeFactory::create (
319
+ TemplateTypeScope::createWithFunction ($ functionName ?? '_ ' ),
320
+ $ name ,
321
+ $ bound ,
322
+ TemplateTypeVariance::createInvariant (),
323
+ );
333
324
return [
334
325
'simple ' => [
335
326
new IntegerType (),
0 commit comments