Skip to content

Commit d239224

Browse files
committed
Drop nullable $eventName parameter support on StimulusAttributes::normalizeEventName() method
Resolves suggestion #2159 (comment)
1 parent 02d5314 commit d239224

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/StimulusBundle/src/Dto/StimulusAttributes.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function addAction(string $controllerName, string $actionName, ?string $e
7575
$this->actions[] = [
7676
'controllerName' => $controllerName,
7777
'actionName' => $actionName,
78-
'eventName' => $this->normalizeEventName($eventName),
78+
'eventName' => null !== $eventName ? $this->normalizeEventName($eventName) : null,
7979
];
8080

8181
foreach ($parameters as $name => $value) {
@@ -221,12 +221,8 @@ private function normalizeControllerName(string $controllerName): string
221221
/**
222222
* @see https://stimulus.hotwired.dev/reference/actions
223223
*/
224-
private function normalizeEventName(?string $eventName): ?string
224+
private function normalizeEventName(string $eventName): string
225225
{
226-
if (null === $eventName) {
227-
return null;
228-
}
229-
230226
return preg_replace_callback('/^.+(?=:)/', fn (array $matches): string => $this->normalizeControllerName($matches[0]), $eventName);
231227
}
232228

0 commit comments

Comments
 (0)