@@ -28,8 +28,12 @@ public function definition()
28
28
}
29
29
}
30
30
31
- $ factory = UserFactory::new ();
32
- assertType ('UserFactory ' , $ factory );
31
+ assertType ('UserFactory ' , $ factory = UserFactory::new ());
32
+ assertType ('UserFactory ' , UserFactory::new (['string ' => 'string ' ]));
33
+ assertType ('UserFactory ' , UserFactory::new (function ($ attributes ) {
34
+ // assertType('array<string, mixed>', $attributes);
35
+ return ['string ' => 'string ' ];
36
+ }));
33
37
34
38
assertType ('array<string, mixed> ' , $ factory ->definition ());
35
39
@@ -39,16 +43,28 @@ public function definition()
39
43
40
44
assertType ('array<int|string, mixed> ' , $ factory ->raw ());
41
45
assertType ('array<int|string, mixed> ' , $ factory ->raw (['string ' => 'string ' ]));
46
+ assertType ('array<int|string, mixed> ' , $ factory ->raw (function ($ attributes ) {
47
+ // assert('array<string, mixed>', $attributes);
48
+ return ['string ' => 'string ' ];
49
+ }));
42
50
43
51
// assertType('User', $factory->createOne());
44
52
// assertType('User', $factory->createOne(['string' => 'string']));
45
53
assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->createOne ());
46
54
assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->createOne (['string ' => 'string ' ]));
55
+ assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->createOne (function ($ attributes ) {
56
+ // assertType('array<string, mixed>', $attributes);
57
+ return ['string ' => 'string ' ];
58
+ }));
47
59
48
60
// assertType('User', $factory->createOneQuietly());
49
61
// assertType('User', $factory->createOneQuietly(['string' => 'string']));
50
62
assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->createOneQuietly ());
51
63
assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->createOneQuietly (['string ' => 'string ' ]));
64
+ assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->createOneQuietly (function ($ attributes ) {
65
+ // assertType('array<string, mixed>', $attributes);
66
+ return ['string ' => 'string ' ];
67
+ }));
52
68
53
69
// assertType('Illuminate\Database\Eloquent\Collection<int, User>', $factory->createMany([['string' => 'string']]));
54
70
assertType ('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model> ' , $ factory ->createMany (
@@ -68,6 +84,10 @@ public function definition()
68
84
assertType ('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model>|Illuminate\Database\Eloquent\Model ' , $ factory ->create ([
69
85
'string ' => 'string ' ,
70
86
]));
87
+ assertType ('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model>|Illuminate\Database\Eloquent\Model ' , $ factory ->create (function ($ attributes ) {
88
+ // assertType('array<string, mixed>', $attributes);
89
+ return ['string ' => 'string ' ];
90
+ }));
71
91
72
92
// assertType('Illuminate\Database\Eloquent\Collection<int, User>|User', $factory->createQuietly());
73
93
// assertType('Illuminate\Database\Eloquent\Collection<int, User>|User', $factory->createQuietly([
@@ -95,6 +115,10 @@ public function definition()
95
115
assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->makeOne ([
96
116
'string ' => 'string ' ,
97
117
]));
118
+ assertType ('Illuminate\Database\Eloquent\Model ' , $ factory ->makeOne (function ($ attributes ) {
119
+ // assert('array<string, mixed>', $attributes);
120
+ return ['string ' => 'string ' ];
121
+ }));
98
122
99
123
// assertType('Illuminate\Database\Eloquent\Collection<int, User>|User', $factory->make());
100
124
// assertType('Illuminate\Database\Eloquent\Collection<int, User>|User', $factory->make([
@@ -104,6 +128,10 @@ public function definition()
104
128
assertType ('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model>|Illuminate\Database\Eloquent\Model ' , $ factory ->make ([
105
129
'string ' => 'string ' ,
106
130
]));
131
+ assertType ('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model>|Illuminate\Database\Eloquent\Model ' , $ factory ->make (function ($ attributes ) {
132
+ // assert('array<string, mixed>', $attributes);
133
+ return ['string ' => 'string ' ];
134
+ }));
107
135
108
136
assertType ('UserFactory ' , $ factory ->state (['string ' => 'string ' ]));
109
137
assertType ('UserFactory ' , $ factory ->state (function () {
0 commit comments