Skip to content

Commit

Permalink
Drop nullable $eventName parameter support on StimulusAttributes::nor…
Browse files Browse the repository at this point in the history
…malizeEventName() method

Resolves suggestion symfony#2159 (comment)
  • Loading branch information
7-zete-7 committed Sep 28, 2024
1 parent 02d5314 commit d239224
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/StimulusBundle/src/Dto/StimulusAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function addAction(string $controllerName, string $actionName, ?string $e
$this->actions[] = [
'controllerName' => $controllerName,
'actionName' => $actionName,
'eventName' => $this->normalizeEventName($eventName),
'eventName' => null !== $eventName ? $this->normalizeEventName($eventName) : null,
];

foreach ($parameters as $name => $value) {
Expand Down Expand Up @@ -221,12 +221,8 @@ private function normalizeControllerName(string $controllerName): string
/**
* @see https://stimulus.hotwired.dev/reference/actions
*/
private function normalizeEventName(?string $eventName): ?string
private function normalizeEventName(string $eventName): string
{
if (null === $eventName) {
return null;
}

return preg_replace_callback('/^.+(?=:)/', fn (array $matches): string => $this->normalizeControllerName($matches[0]), $eventName);
}

Expand Down

0 comments on commit d239224

Please sign in to comment.