Skip to content

Commit b855232

Browse files
AzGasimgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 738dabf commit b855232

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

packages/prompts/src/Filament/Components/RunCommandComponent.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function prefillPromptForm(array $prompt): void
185185
$method = $prompt['method'] ?? '';
186186
$params = $prompt['params'] ?? [];
187187
$p = PromptParamsHelper::extract($method, $params);
188-
188+
189189
// Wenn bereits eine Antwort vorhanden ist, diese verwenden
190190
if (isset($this->answers[$promptId])) {
191191
$value = $this->answers[$promptId];
@@ -200,6 +200,7 @@ protected function prefillPromptForm(array $prompt): void
200200
}
201201
}
202202
$this->form->fill([$promptId => $value]);
203+
203204
return;
204205
}
205206

@@ -208,6 +209,7 @@ protected function prefillPromptForm(array $prompt): void
208209
$default = $p['default'] ?? false; // default Parameter (bool)
209210
$value = $default ? 'yes' : 'no';
210211
$this->form->fill([$promptId => $value]);
212+
211213
return;
212214
}
213215

@@ -223,6 +225,7 @@ protected function prefillPromptForm(array $prompt): void
223225
if (! empty($fillData)) {
224226
$this->form->fill($fillData);
225227
}
228+
226229
return;
227230
}
228231

@@ -317,7 +320,7 @@ public function submitPrompt(): void
317320
$answer = false;
318321
}
319322

320-
if (($answer === null || $answer === '' || ($this->currentPrompt['method'] === 'multiselect' && ! is_array($answer))) && $this->currentPrompt['method'] !== 'confirm') {
323+
if (($answer === null || $answer === '' || ($this->currentPrompt['method'] === 'multiselect' && ! is_array($answer))) && $this->currentPrompt['method'] !== 'confirm') {
321324
try {
322325
$data = $this->form->getState();
323326
$answer = $data[$promptId] ?? null;
@@ -612,7 +615,7 @@ protected function createFieldFromPrompt(string $promptId, string $method, array
612615
$defaultValue = $this->answers[$promptId] ?? null;
613616
$options = $p['options'] ?? [];
614617
$defaultSelect = $defaultValue ?? ($p['default'] ?? null);
615-
618+
616619
// Für confirm: Default aus params[1] (default Parameter), falls noch keine Antwort vorhanden
617620
$confirmDefault = null;
618621
if ($method === 'confirm') {

packages/prompts/src/Support/PromptParamsHelper.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
/**
66
* Helper-Klasse zum Zugriff auf Prompt-Parameter.
7-
*
7+
*
88
* Statt direkt auf $params[0], $params[1] etc. zuzugreifen,
99
* verwenden wir diese Helper-Methoden, die die Parameter-Namen kennen.
10-
*
10+
*
1111
* So sind wir robuster gegen Änderungen in Laravel Prompts,
1212
* solange die Parameter-Namen gleich bleiben.
1313
*/
1414
class PromptParamsHelper
1515
{
1616
/**
1717
* Extrahiert die Parameter für eine Prompt-Methode als assoziatives Array.
18-
*
19-
* @param string $method Die Prompt-Methode (z.B. 'text', 'confirm', 'select')
20-
* @param array $params Die numerischen Parameter-Array
18+
*
19+
* @param string $method Die Prompt-Methode (z.B. 'text', 'confirm', 'select')
20+
* @param array $params Die numerischen Parameter-Array
2121
* @return array Assoziatives Array mit Parameternamen als Keys
2222
*/
2323
public static function extract(string $method, array $params): array
@@ -81,18 +81,16 @@ public static function extract(string $method, array $params): array
8181

8282
/**
8383
* Gibt einen einzelnen Parameter zurück.
84-
*
85-
* @param string $method Die Prompt-Methode
86-
* @param array $params Die numerischen Parameter-Array
87-
* @param string $paramName Der Name des Parameters (z.B. 'label', 'default')
88-
* @param mixed $default Der Default-Wert, falls der Parameter nicht existiert
89-
* @return mixed
84+
*
85+
* @param string $method Die Prompt-Methode
86+
* @param array $params Die numerischen Parameter-Array
87+
* @param string $paramName Der Name des Parameters (z.B. 'label', 'default')
88+
* @param mixed $default Der Default-Wert, falls der Parameter nicht existiert
9089
*/
9190
public static function get(string $method, array $params, string $paramName, mixed $default = null): mixed
9291
{
9392
$extracted = self::extract($method, $params);
94-
93+
9594
return $extracted[$paramName] ?? $default;
9695
}
9796
}
98-

0 commit comments

Comments
 (0)