Skip to content

Commit

Permalink
Merge branch 'l11' of github.com:protonemedia/laravel-splade into l11
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Mar 9, 2024
2 parents 3f73301 + eea53d9 commit 6c2d3a7
Show file tree
Hide file tree
Showing 28 changed files with 55 additions and 110 deletions.
4 changes: 2 additions & 2 deletions app/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class User extends Authenticatable implements HasMedia
{
use HasApiTokens, HasFactory, Notifiable, InteractsWithMedia;
use HasApiTokens, HasFactory, InteractsWithMedia, Notifiable;

/**
* The attributes that are mass assignable.
Expand Down Expand Up @@ -61,7 +61,7 @@ public function registerMediaCollections(): void
$this->addMediaCollection('photos');
}

public function registerMediaConversions(Media $media = null): void
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')->fit('contain', 50, 50);
}
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function rules(...$arguments): array
*
* @param mixed ...$params
*/
public function validate(Request $request = null, ...$params): array
public function validate(?Request $request = null, ...$params): array
{
/** @var Request */
$request = $request ?? request();
Expand Down
9 changes: 0 additions & 9 deletions src/AbstractTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ abstract class AbstractTable
{
/**
* The SpladeTable instance.
*
* @var \ProtoneMedia\Splade\SpladeTable|null
*/
private ?SpladeTable $table = null;

Expand All @@ -37,8 +35,6 @@ public function for()

/**
* Helper method to create a new SpladeTable instance.
*
* @return \ProtoneMedia\Splade\SpladeTable
*/
public static function build(...$arguments): SpladeTable
{
Expand All @@ -50,8 +46,6 @@ public static function build(...$arguments): SpladeTable
/**
* Creates a new SpladeTable instance with the resource or
* query builder from the 'for()' method of this class.
*
* @return \ProtoneMedia\Splade\SpladeTable
*/
public function make(): SpladeTable
{
Expand All @@ -71,7 +65,6 @@ function (SpladeTable $table) {
/**
* Configure the given SpladeTable.
*
* @param \ProtoneMedia\Splade\SpladeTable $table
* @return void
*/
public function configure(SpladeTable $table)
Expand All @@ -81,8 +74,6 @@ public function configure(SpladeTable $table)

/**
* Returns a TableExporter instance.
*
* @return \ProtoneMedia\Splade\TableExporter|null
*/
public function makeExporter(int $key): ?TableExporter
{
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class Form extends Component
{
use ParsesJsonDataAttribute;
use InteractsWithFormElement;
use ParsesJsonDataAttribute;

public string $spladeId;

Expand Down
2 changes: 0 additions & 2 deletions src/Components/Form/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ public function options(): array

/**
* Returns the placeholder option when necessary.
*
* @return \ProtoneMedia\Splade\FormSelectOption
*/
public function placeholderOption(): ?FormSelectOption
{
Expand Down
1 change: 0 additions & 1 deletion src/EventRedirectFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public function __construct(
*
* @param string $method
* @param array $parameters
* @return \ProtoneMedia\Splade\EventRedirect
*/
public function __call($method, $parameters): EventRedirect
{
Expand Down
6 changes: 1 addition & 5 deletions src/FileUploads/ExistingFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ public static function fromMediaLibraryWithoutPreview($media)

/**
* Returns an instance of ExistingFileFromDisk to load the file from a disk.
*
* @return \ProtoneMedia\Splade\FileUploads\ExistingFileFromDisk
*/
public static function fromDisk(string $disk): ExistingFileFromDisk
{
Expand All @@ -137,8 +135,6 @@ public static function fromDisk(string $disk): ExistingFileFromDisk
/**
* Returns an instance of ExistingFileFromDisk to load the file from a disk,
* but without a preview.
*
* @return \ProtoneMedia\Splade\FileUploads\ExistingFileFromDisk
*/
public static function fromDiskWithoutPreview(string $disk): ExistingFileFromDisk
{
Expand Down Expand Up @@ -254,7 +250,7 @@ public function getIdentifier(): string
*
* @return string
*/
public function getMetadata(string $key = null)
public function getMetadata(?string $key = null)
{
return $key ? Arr::get($this->metadata, $key) : $this->metadata;
}
Expand Down
9 changes: 0 additions & 9 deletions src/FileUploads/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public function __construct(private string $disk)

/**
* Stores the uploaded file as a temporary file.
*
* @return \ProtoneMedia\Splade\FileUploads\TemporaryFileUpload
*/
public function storeUploadedFileTemporarely(UploadedFile $file): TemporaryFileUpload
{
Expand Down Expand Up @@ -68,8 +66,6 @@ public function deleteTemporaryFiles()

/**
* Returns a boolean whether the file exists.
*
* @param \ProtoneMedia\Splade\FileUploads\TemporaryFileUpload $temporaryFileUpload
*/
public function exists(TemporaryFileUpload $temporaryFileUpload): bool
{
Expand All @@ -78,9 +74,6 @@ public function exists(TemporaryFileUpload $temporaryFileUpload): bool

/**
* Returns an instance of SpladeUploadedFile when the temporary file exists.
*
* @param \ProtoneMedia\Splade\FileUploads\TemporaryFileUpload $temporaryFileUpload
* @return \ProtoneMedia\Splade\FileUploads\SpladeUploadedFile|null
*/
public function makeUploadedFile(TemporaryFileUpload $temporaryFileUpload): ?SpladeUploadedFile
{
Expand All @@ -99,8 +92,6 @@ public function makeUploadedFile(TemporaryFileUpload $temporaryFileUpload): ?Spl

/**
* Deletes the temporary file.
*
* @param \ProtoneMedia\Splade\FileUploads\TemporaryFileUpload $temporaryFileUpload
*/
public function delete(TemporaryFileUpload $temporaryFileUpload): bool
{
Expand Down
2 changes: 0 additions & 2 deletions src/FileUploads/SpladeUploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public function isValid(): bool

/**
* Sets the temporary file upload.
*
* @param \ProtoneMedia\Splade\FileUploads\TemporaryFileUpload $temporaryFileUpload
*/
public function setTemporaryFileUpload(TemporaryFileUpload $temporaryFileUpload): self
{
Expand Down
2 changes: 1 addition & 1 deletion src/FormBuilder/Checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class Checkboxes extends Component
{
use HasOptions;
use CanBeInline;
use HasOptions;

/**
* Renders the SpladeCheckboxex
Expand Down
2 changes: 1 addition & 1 deletion src/FormBuilder/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function attributes(array $attributes): self
/**
* Adds one or more validation rules to an input field
*
* @param mixed ...$rules One or more rules, may be an array of strings or multiple strings
* @param mixed ...$rules One or more rules, may be an array of strings or multiple strings
* @return $this
*/
public function rules(...$rules): self
Expand Down
2 changes: 1 addition & 1 deletion src/FormBuilder/Concerns/HasOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trait HasOptions
/**
* Set an array with options
*
* @param array $options ['value1' => 'Label 1', 'value2' => 'Label 2']
* @param array $options ['value1' => 'Label 1', 'value2' => 'Label 2']
* @return $this
*/
public function options(array $options = []): self
Expand Down
2 changes: 1 addition & 1 deletion src/FormBuilder/Radios.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class Radios extends Component
{
use HasOptions;
use CanBeInline;
use HasOptions;

/**
* Renders the SpladeRadios
Expand Down
2 changes: 1 addition & 1 deletion src/Http/SpladeMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function terminate($request, $response)
*
* @return void
*/
public static function afterOriginalResponse(Closure $callback = null)
public static function afterOriginalResponse(?Closure $callback = null)
{
static::$afterOriginalResponseCallback = $callback;
}
Expand Down
10 changes: 3 additions & 7 deletions src/PasswordValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public function recentlyConfirmed(Request $request): bool

/**
* Validate the given user's password using Laravel Fortify.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
*/
private function validateWithFortify(Authenticatable $user = null, string $password): bool
private function validateWithFortify(?Authenticatable $user, string $password): bool
{
return app(ConfirmPassword::class)(
app(StatefulGuard::class), $user, $password
Expand All @@ -61,10 +59,8 @@ private function validateWithFortify(Authenticatable $user = null, string $passw

/**
* Validate the given user's password using regular Laravel Auth logic.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
*/
private function validateWithoutForfify(Authenticatable $user = null, string $password): bool
private function validateWithoutForfify(?Authenticatable $user, string $password): bool
{
$guard = Auth::guard(config('splade.confirm_password_guard'));

Expand All @@ -85,7 +81,7 @@ public function validateRequest(Request $request, string $attribute): bool
/**
* Validates the given User and password.
*/
public function validate(Authenticatable $user = null, string $password, string $attribute): bool
public function validate(?Authenticatable $user, string $password, string $attribute): bool
{
if (!$user) {
throw ValidationException::withMessages([
Expand Down
1 change: 0 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ private function registerRequestMacros()
/**
* Adds the default transitions to the repository.
*
* @param \ProtoneMedia\Splade\TransitionRepository $transitionRepository
* @return void
*/
public static function registerTransitionAnimations(TransitionRepository $transitionRepository)
Expand Down
18 changes: 1 addition & 17 deletions src/SpladeCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ public function reset(): self

/**
* Getter for the Head instance.
*
* @return \ProtoneMedia\Splade\Head
*/
public function head(): Head
{
Expand Down Expand Up @@ -269,8 +267,6 @@ public function onLazy($value)

/**
* Returns a new EventRefresh instance.
*
* @return \ProtoneMedia\Splade\EventRefresh
*/
public static function refreshOnEvent(): EventRefresh
{
Expand All @@ -279,8 +275,6 @@ public static function refreshOnEvent(): EventRefresh

/**
* Returns a new EventRedirectFactory instance.
*
* @return \ProtoneMedia\Splade\EventRedirectFactory
*/
public static function redirectOnEvent(): EventRedirectFactory
{
Expand All @@ -289,8 +283,6 @@ public static function redirectOnEvent(): EventRedirectFactory

/**
* Returns a new instance of the ToastBuilder.
*
* @return \ProtoneMedia\Splade\SpladeToastBuilder
*/
public function toastBuilder(): SpladeToastBuilder
{
Expand All @@ -299,8 +291,6 @@ public function toastBuilder(): SpladeToastBuilder

/**
* Returns a new SpladeToast instance
*
* @return \ProtoneMedia\Splade\SpladeToast
*/
public static function toastOnEvent(string $message = ''): SpladeToast
{
Expand All @@ -320,10 +310,8 @@ public static function toastOnEvent(string $message = ''): SpladeToast
/**
* Returns a Closure that prevents generating a response from
* a ValidationException when this is a Splade request.
*
* @param callable $renderUsing
*/
public static function exceptionHandler(Handler $exceptionHandler, callable $renderUsing = null): Closure
public static function exceptionHandler(Handler $exceptionHandler, ?callable $renderUsing = null): Closure
{
return Closure::bind(function (Throwable $e, $request) use ($renderUsing) {
if ($renderUsing) {
Expand Down Expand Up @@ -356,8 +344,6 @@ public static function exceptionHandler(Handler $exceptionHandler, callable $ren
/**
* Returns a new SpladeToast instance, optionally with the given message
* if it isn't empty, and it uses the custom toast factory if set.
*
* @return \ProtoneMedia\Splade\SpladeToast
*/
public function toast(string $message = ''): SpladeToast
{
Expand Down Expand Up @@ -392,8 +378,6 @@ public function getDataStores(): array

/**
* Adds a new Data Store.
*
* @param \ProtoneMedia\Splade\DataStore $store
*/
public function addDataStore(DataStore $store): self
{
Expand Down
20 changes: 10 additions & 10 deletions src/SpladeForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public function class(array|string $class): self
*/
public function confirm(
string|bool $confirm = true,
string $text = null,
string $confirmButton = null,
string $cancelButton = null,
?string $text = null,
?string $confirmButton = null,
?string $cancelButton = null,
bool $danger = false,
string|bool $requirePassword = false,
bool $requirePasswordOnce = false
Expand Down Expand Up @@ -158,10 +158,10 @@ public function preserveScroll(bool $preserve_scroll = true): self
*/
public function requirePassword(
bool $requirePasswordOnce = false,
string $heading = null,
string $text = null,
string $confirmButton = null,
string $cancelButton = null,
?string $heading = null,
?string $text = null,
?string $confirmButton = null,
?string $cancelButton = null,
bool $danger = false
): self {
return $this->confirm(
Expand All @@ -178,7 +178,7 @@ public function requirePassword(
/**
* Prevent navigation on submit.
*
* @param string $actionOnSuccess reset|restore
* @param string $actionOnSuccess reset|restore
* @return $this
*/
public function stay(bool $stay = true, string $actionOnSuccess = ''): self
Expand All @@ -201,7 +201,7 @@ public function stay(bool $stay = true, string $actionOnSuccess = ''): self
*/
public function submitOnChange(
bool $enabled = true,
array|string $watchFields = null,
array|string|null $watchFields = null,
bool $background = true,
int $debounce = 500
): self {
Expand Down Expand Up @@ -293,7 +293,7 @@ public function getRules(): array
*
* @param [type] ...$params
*/
public function validate(Request $request = null, ...$params): array
public function validate(?Request $request = null, ...$params): array
{
/** @var Request */
$request = $request ?? request();
Expand Down
Loading

0 comments on commit 6c2d3a7

Please sign in to comment.