Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysm authored and github-actions[bot] committed Dec 27, 2023
1 parent ee815a3 commit 42082d6
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 40 deletions.
10 changes: 5 additions & 5 deletions src/Broadcasters/Broadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public function broadcast(
array $channels,
bool $later,
string $action,
string $target = null,
string $targets = null,
string $partial = null,
?string $target = null,
?string $targets = null,
?string $partial = null,
?array $partialData = [],
string $inlineContent = null,
?string $inlineContent = null,
bool $escapeInlineContent = true,
array $attributes = [],
string $exceptSocket = null,
?string $exceptSocket = null,
): void;
}
10 changes: 5 additions & 5 deletions src/Broadcasters/LaravelBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public function broadcast(
array $channels,
bool $later,
string $action,
string $target = null,
string $targets = null,
string $partial = null,
?string $target = null,
?string $targets = null,
?string $partial = null,
?array $partialData = [],
string $inlineContent = null,
?string $inlineContent = null,
bool $escapeInlineContent = true,
array $attributes = [],
string $exceptSocket = null,
?string $exceptSocket = null,
): void {
$job = new BroadcastAction(
$channels,
Expand Down
18 changes: 9 additions & 9 deletions src/Broadcasting/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,42 @@ public function fake()
return $this;
}

public function broadcastAppend($content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastAppend($content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('append', $content, $target, $targets, $channel, $attributes);
}

public function broadcastPrepend($content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastPrepend($content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('prepend', $content, $target, $targets, $channel, $attributes);
}

public function broadcastBefore($content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastBefore($content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('before', $content, $target, $targets, $channel, $attributes);
}

public function broadcastAfter($content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastAfter($content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('after', $content, $target, $targets, $channel, $attributes);
}

public function broadcastUpdate($content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastUpdate($content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('update', $content, $target, $targets, $channel, $attributes);
}

public function broadcastReplace($content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastReplace($content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('replace', $content, $target, $targets, $channel, $attributes);
}

public function broadcastRemove(Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastRemove(Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
return $this->broadcastAction('remove', null, $target, $targets, $channel, $attributes);
}

public function broadcastRefresh(Channel|Model|Collection|array|string $channel = null)
public function broadcastRefresh(Channel|Model|Collection|array|string|null $channel = null)
{
return $this->broadcastAction(
action: 'refresh',
Expand All @@ -98,7 +98,7 @@ public function broadcastRefresh(Channel|Model|Collection|array|string $channel
));
}

public function broadcastAction(string $action, $content = null, Model|string $target = null, string $targets = null, Channel|Model|Collection|array|string $channel = null, array $attributes = [])
public function broadcastAction(string $action, $content = null, Model|string|null $target = null, ?string $targets = null, Channel|Model|Collection|array|string|null $channel = null, array $attributes = [])
{
$broadcast = new PendingBroadcast(
channels: $channel ? $this->resolveChannels($channel) : [],
Expand Down
2 changes: 1 addition & 1 deletion src/Broadcasting/PendingBroadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PendingBroadcast
*/
protected array $deferredCancelCallbacks = [];

public function __construct(array $channels, string $action, Rendering $rendering, string $target = null, string $targets = null, array $attributes = [])
public function __construct(array $channels, string $action, Rendering $rendering, ?string $target = null, ?string $targets = null, array $attributes = [])
{
$this->action = $action;
$this->target = $target;
Expand Down
2 changes: 1 addition & 1 deletion src/Broadcasting/Rendering.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Rendering

public bool $escapeInlineContent = true;

public function __construct(string $partial = null, ?array $data = [], string $inlineContent = null, ?bool $escapeInlineContent = true)
public function __construct(?string $partial = null, ?array $data = [], ?string $inlineContent = null, ?bool $escapeInlineContent = true)
{
$this->partial = $partial;
$this->data = $data;
Expand Down
2 changes: 1 addition & 1 deletion src/Events/TurboStreamBroadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TurboStreamBroadcast implements ShouldBroadcastNow

public bool $escapeInlineContent = true;

public function __construct(array $channels, string $action, string $target = null, string $targets = null, string $partial = null, ?array $partialData = [], string $inlineContent = null, bool $escapeInlineContent = true, array $attributes = [])
public function __construct(array $channels, string $action, ?string $target = null, ?string $targets = null, ?string $partial = null, ?array $partialData = [], ?string $inlineContent = null, bool $escapeInlineContent = true, array $attributes = [])
{
$this->channels = $channels;
$this->action = $action;
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/TurboMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function turboVisit($request)
/**
* @param \Illuminate\Http\Request $request
*/
private function guessFormRedirectUrl($request, string $defaultRedirectUrl = null)
private function guessFormRedirectUrl($request, ?string $defaultRedirectUrl = null)
{
if ($this->inExceptArray($request)) {
return $defaultRedirectUrl;
Expand Down
10 changes: 5 additions & 5 deletions src/Http/PendingTurboStreamResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PendingTurboStreamResponse implements Htmlable, Renderable, Responsable

private array $useCustomAttributes = [];

public static function forModel(Model $model, string $action = null): self
public static function forModel(Model $model, ?string $action = null): self
{
$builder = new self();

Expand Down Expand Up @@ -242,7 +242,7 @@ public function refresh(): self
->attributes(array_filter(['request-id' => Turbo::currentRequestId()]));
}

private function buildAction(string $action, Model|string $target = null, $content = null, Rendering $rendering = null, array $attributes = [])
private function buildAction(string $action, Model|string|null $target = null, $content = null, ?Rendering $rendering = null, array $attributes = [])
{
$this->useAction = $action;
$this->useTarget = $target instanceof Model ? $this->resolveTargetFor($target) : $target;
Expand All @@ -265,7 +265,7 @@ private function buildActionAll(string $action, Model|string $targets, $content
return $this;
}

public function broadcastTo($channel, callable $callback = null)
public function broadcastTo($channel, ?callable $callback = null)
{
$callback = $callback ?? function () {
};
Expand All @@ -275,7 +275,7 @@ public function broadcastTo($channel, callable $callback = null)
});
}

public function broadcastToPrivateChannel($channel, callable $callback = null)
public function broadcastToPrivateChannel($channel, ?callable $callback = null)
{
$callback = $callback ?? function () {
};
Expand All @@ -286,7 +286,7 @@ public function broadcastToPrivateChannel($channel, callable $callback = null)
});
}

public function broadcastToPresenceChannel($channel, callable $callback = null)
public function broadcastToPresenceChannel($channel, ?callable $callback = null)
{
$callback = $callback ?? function () {
};
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/BroadcastAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BroadcastAction implements ShouldQueue

public ?string $socket = null;

public function __construct(array $channels, string $action, string $target = null, string $targets = null, string $partial = null, ?array $partialData = [], string $inlineContent = null, bool $escapeInlineContent = true, array $attributes = [], $socket = null)
public function __construct(array $channels, string $action, ?string $target = null, ?string $targets = null, ?string $partial = null, ?array $partialData = [], ?string $inlineContent = null, bool $escapeInlineContent = true, array $attributes = [], $socket = null)
{
$this->channels = $channels;
$this->action = $action;
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Broadcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function asTurboStreamBroadcastingChannel()
return $this->toChannels(Collection::wrap($this->broadcastDefaultStreamables($this->wasRecentlyCreated)));
}

protected function broadcastActionTo($streamables, string $action, Rendering $rendering, string $target = null): PendingBroadcast
protected function broadcastActionTo($streamables, string $action, Rendering $rendering, ?string $target = null): PendingBroadcast
{
return TurboStream::broadcastAction(
action: $action,
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/AssertableTurboStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function has(int $expectedTurboStreamsCount): self
return $this;
}

public function hasTurboStream(Closure $callback = null): self
public function hasTurboStream(?Closure $callback = null): self
{
$callback ??= fn ($matcher) => $matcher;
$attrs = collect();
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/TurboStreamMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function see(string $content): self
return $matcher;
}

public function matches(Closure $callback = null): bool
public function matches(?Closure $callback = null): bool
{
// We first pass the current instance to the callback given in the
// `->assertTurboStream(fn)` call. This is where the `->where()`
Expand Down
7 changes: 3 additions & 4 deletions src/TurboServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use HotwiredLaravel\TurboLaravel\Http\PendingTurboStreamResponse;
use HotwiredLaravel\TurboLaravel\Testing\AssertableTurboStream;
use HotwiredLaravel\TurboLaravel\Testing\ConvertTestResponseToTurboStreamCollection;
use HotwiredLaravel\TurboLaravel\Views\Components as ViewComponents;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -112,7 +111,7 @@ private function configureMacros(): void

private function configureRequestAndResponseMacros(): void
{
ResponseFacade::macro('turboStream', function ($model = null, string $action = null): MultiplePendingTurboStreamResponse|PendingTurboStreamResponse {
ResponseFacade::macro('turboStream', function ($model = null, ?string $action = null): MultiplePendingTurboStreamResponse|PendingTurboStreamResponse {
return turbo_stream($model, $action);
});

Expand All @@ -132,7 +131,7 @@ private function configureRequestAndResponseMacros(): void
return TurboFacade::isTurboNativeVisit();
});

Request::macro('wasFromTurboFrame', function (string $frame = null): bool {
Request::macro('wasFromTurboFrame', function (?string $frame = null): bool {
if (! $frame) {
return $this->hasHeader('Turbo-Frame');
}
Expand All @@ -147,7 +146,7 @@ private function configureTestResponseMacros()
return;
}

TestResponse::macro('assertTurboStream', function (callable $callback = null) {
TestResponse::macro('assertTurboStream', function (?callable $callback = null) {
Assert::assertStringContainsString(
Turbo::TURBO_STREAM_FORMAT,
$this->headers->get('Content-Type'),
Expand Down
4 changes: 2 additions & 2 deletions src/Views/RecordIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(object $record)
$this->record = $record;
}

public function domId(string $prefix = null): string
public function domId(?string $prefix = null): string
{
if ($recordId = $this->record->getKey()) {
return sprintf('%s%s%s', $this->domClass($prefix), self::DELIMITER, $recordId);
Expand All @@ -33,7 +33,7 @@ public function domId(string $prefix = null): string
return $this->domClass($prefix ?: static::NEW_PREFIX);
}

public function domClass(string $prefix = null): string
public function domClass(?string $prefix = null): string
{
$singular = Name::forModel($this->record)->singular;
$delimiter = static::DELIMITER;
Expand Down
2 changes: 1 addition & 1 deletion src/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function dom_class(object $model, string $prefix = ''): string
* @param Model|Collection|array|string|null $model = null
* @param string|null $action = null
*/
function turbo_stream($model = null, string $action = null): MultiplePendingTurboStreamResponse|PendingTurboStreamResponse
function turbo_stream($model = null, ?string $action = null): MultiplePendingTurboStreamResponse|PendingTurboStreamResponse
{
return base_turbo_stream($model, $action);
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function dom_class(object $model, string $prefix = ''): string
* @param Model|Collection|array|string|null $model = null
* @param string|null $action = null
*/
function turbo_stream($model = null, string $action = null): MultiplePendingTurboStreamResponse|PendingTurboStreamResponse
function turbo_stream($model = null, ?string $action = null): MultiplePendingTurboStreamResponse|PendingTurboStreamResponse
{
if (is_array($model) || $model instanceof Collection) {
return MultiplePendingTurboStreamResponse::forStreams($model);
Expand Down

0 comments on commit 42082d6

Please sign in to comment.