Skip to content

Commit

Permalink
Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
joetannenbaum authored and github-actions[bot] committed Oct 21, 2023
1 parent c3b3a8b commit 816cf8f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion playground/spin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use function Laravel\Prompts\spin;

require __DIR__ . '/../vendor/autoload.php';
require __DIR__.'/../vendor/autoload.php';

$result1 = spin(
function () {
Expand Down
8 changes: 4 additions & 4 deletions src/Prompt.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function prompt(): mixed

static::$interactive ??= stream_isatty(STDIN);

if (!static::$interactive) {
if (! static::$interactive) {
return $this->default();
}

Expand Down Expand Up @@ -264,7 +264,7 @@ private function diffLines(string $a, string $b): array
$diff = [];

for ($i = 0; $i < max(count($aLines), count($bLines)); $i++) {
if (!isset($aLines[$i]) || !isset($bLines[$i]) || $aLines[$i] !== $bLines[$i]) {
if (! isset($aLines[$i]) || ! isset($bLines[$i]) || $aLines[$i] !== $bLines[$i]) {
$diff[] = $i;
}
}
Expand Down Expand Up @@ -314,13 +314,13 @@ private function validate(mixed $value): void
return;
}

if (!isset($this->validate)) {
if (! isset($this->validate)) {
return;
}

$error = ($this->validate)($value);

if (!is_string($error) && !is_null($error)) {
if (! is_string($error) && ! is_null($error)) {
throw new \RuntimeException('The validator must return a string or null.');
}

Expand Down
6 changes: 2 additions & 4 deletions src/Spinner.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class Spinner extends Prompt

/**
* The final message to display.
*
* @var string
*/
public string $finalMessage = '';

Expand Down Expand Up @@ -63,7 +61,7 @@ public function spin(Closure $callback): mixed
{
$this->capturePreviousNewLines();

if (!function_exists('pcntl_fork')) {
if (! function_exists('pcntl_fork')) {
return $this->renderStatically($callback);
}

Expand Down Expand Up @@ -191,7 +189,7 @@ protected function eraseRenderedLines(): void
*/
public function __destruct()
{
if (!empty($this->pid)) {
if (! empty($this->pid)) {
posix_kill($this->pid, SIGHUP);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Themes/Default/SpinnerRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __invoke(Spinner $spinner): string
if ($spinner->finalMessage !== '') {
$finalMessage = wordwrap($spinner->finalMessage, $spinner->terminal()->cols() - 6);

collect(explode(PHP_EOL, $finalMessage))->each(fn ($line) => $this->line(' ' . $line));
collect(explode(PHP_EOL, $finalMessage))->each(fn ($line) => $this->line(' '.$line));

// Avoid partial line indicator on re-render
$this->line('');
Expand Down

0 comments on commit 816cf8f

Please sign in to comment.