From 57395310c23820db81fe08848e3db0133788785f Mon Sep 17 00:00:00 2001 From: Vlad Rusu Date: Sat, 21 Oct 2023 22:16:58 +0300 Subject: [PATCH] Update WireElementsModalUpgrade.php Confusion between php and js code syntax --- src/WireElementsModalUpgrade.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/WireElementsModalUpgrade.php b/src/WireElementsModalUpgrade.php index 1af7cc3..55861b0 100644 --- a/src/WireElementsModalUpgrade.php +++ b/src/WireElementsModalUpgrade.php @@ -29,16 +29,16 @@ public function handle(UpgradeCommand $console, \Closure $next) $this->interactiveReplacement( console: $console, title: '$this->dispatch now expects named arguments.', - before: '$this->dispatch(\'openModal\', \'component-name\', {user: 1})', - after: '$this->dispatch(\'openModal\', {component: \'component-name\', arguments: {user: 1}})', + before: '$this->dispatch(\'openModal\', \'component-name\', [\'user\' => 1])', + after: '$this->dispatch(\'openModal\', component: \'component-name\', arguments: [\'user\' => 1])', pattern: '/\$this->(?:dispatch|emit)\(\'openModal\'(?:,\s?)([^,|\)]*)(?:,\s?)?((?:(?:.|\s)*?).*)\)/', replacement: function($matches) { $component = $matches[1]; $arguments = $matches[2]; if (empty($arguments)) { - return "\$this->dispatch('openModal', { component: $component })"; + return "\$this->dispatch('openModal', component: $component)"; } - return "\$this->dispatch('openModal', { component: $component, arguments: $arguments })"; + return "\$this->dispatch('openModal', component: $component, arguments: $arguments)"; }, directories: ['app', 'tests'] ); @@ -72,4 +72,4 @@ public function handle(UpgradeCommand $console, \Closure $next) return $next($console); } -} \ No newline at end of file +}