Skip to content

Commit c786728

Browse files
committed
Fix bug where object type-hint in listener tricked make:subscriber
1 parent e0a5f7d commit c786728

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/EventRegistry.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ public function getEventClassName(string $event)
149149
return Event::class;
150150
}
151151

152+
// ignore an "object" type-hint
153+
if ('object' === $type) {
154+
continue;
155+
}
156+
152157
return $type;
153158
}
154159
}

tests/EventRegistryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function testGetEventClassNameReturnsType()
3030
'someFunctionToSkip',
3131
[$eventObj, 'methodNoArg'],
3232
[$eventObj, 'methodNoType'],
33+
[$eventObj, 'methodObjectType'],
3334
[$eventObj, 'methodWithType'],
3435
]);
3536

@@ -85,6 +86,10 @@ public function methodNoType($event)
8586
{
8687
}
8788

89+
public function methodObjectType(object $event)
90+
{
91+
}
92+
8893
public function methodWithType(GetResponseForExceptionEvent $event)
8994
{
9095
}

0 commit comments

Comments
 (0)