2424use Patchlevel \EventSourcing \Tests \Unit \Fixture \ProfileVisited ;
2525use PHPUnit \Framework \Attributes \CoversClass ;
2626use PHPUnit \Framework \TestCase ;
27- use Stringable ;
27+ use Symfony \ Component \ TypeInfo \ Type ;
2828
2929#[CoversClass(AttributeSubscriberMetadataFactory::class)]
3030final class AttributeSubscriberMetadataFactoryTest extends TestCase
@@ -189,14 +189,14 @@ public function profileCreated(ProfileCreated $profileCreated, string $aggregate
189189 [
190190 ProfileVisited::class => new SubscribeMethodMetadata (
191191 'profileVisited ' ,
192- [new ArgumentMetadata ('message ' , Message::class)],
192+ [new ArgumentMetadata ('message ' , Type:: object ( Message::class) )],
193193 ),
194194
195195 ProfileCreated::class => new SubscribeMethodMetadata (
196196 'profileCreated ' ,
197197 [
198- new ArgumentMetadata ('profileCreated ' , ProfileCreated::class),
199- new ArgumentMetadata ('aggregateId ' , ' string ' ),
198+ new ArgumentMetadata ('profileCreated ' , Type:: object ( ProfileCreated::class) ),
199+ new ArgumentMetadata ('aggregateId ' , Type:: string () ),
200200 ],
201201 ),
202202 ],
@@ -220,7 +220,7 @@ public function profileVisited(ProfileVisited|null $message): void
220220 self ::assertEquals (
221221 [
222222 ProfileVisited::class => new SubscribeMethodMetadata ('profileVisited ' , [
223- new ArgumentMetadata ('message ' , ProfileVisited::class, true ),
223+ new ArgumentMetadata ('message ' , Type:: nullable (Type:: object ( ProfileVisited::class)) ),
224224 ]),
225225 ],
226226 $ metadata ->subscribeMethods ,
@@ -245,38 +245,6 @@ public function profileVisited($message): void
245245 $ metadataFactory ->metadata ($ subscriber ::class);
246246 }
247247
248- public function testUnionTypeNotSupported (): void
249- {
250- $ this ->expectException (ArgumentTypeNotSupported::class);
251-
252- $ subscriber = new #[Subscriber('foo ' , RunMode::FromBeginning)]
253- class {
254- #[Subscribe(ProfileVisited::class)]
255- public function profileVisited (ProfileVisited |ProfileCreated $ event ): void
256- {
257- }
258- };
259-
260- $ metadataFactory = new AttributeSubscriberMetadataFactory ();
261- $ metadataFactory ->metadata ($ subscriber ::class);
262- }
263-
264- public function testIntersectionTypeNotSupported (): void
265- {
266- $ this ->expectException (ArgumentTypeNotSupported::class);
267-
268- $ subscriber = new #[Subscriber('foo ' , RunMode::FromBeginning)]
269- class {
270- #[Subscribe(ProfileVisited::class)]
271- public function profileVisited (ProfileVisited &Stringable $ event ): void
272- {
273- }
274- };
275-
276- $ metadataFactory = new AttributeSubscriberMetadataFactory ();
277- $ metadataFactory ->metadata ($ subscriber ::class);
278- }
279-
280248 public function testSubscribeAllWithExplicitSubscribeMethod (): void
281249 {
282250 $ this ->expectException (DuplicateSubscribeMethod::class);
0 commit comments