Skip to content

Commit fff82d0

Browse files
committed
Use shorthand nullability typings for better readability
1 parent 523aeb8 commit fff82d0

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

src/ThemeServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ThemeServiceProvider extends ServiceProvider
1414
protected string $packageName = 'theme-name';
1515
protected array $commands = [];
1616
protected bool $theme = true;
17-
protected null|string $componentsNamespace = null;
17+
protected ?string $componentsNamespace = null;
1818

1919
/**
2020
* -------------------------

src/app/Http/Controllers/Auth/VerifyEmailController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class VerifyEmailController extends Controller
1313
{
14-
public null|string $redirectTo = null;
14+
public ?string $redirectTo = null;
1515

1616
/**
1717
* Create a new controller instance.

src/app/Library/CrudPanel/Traits/Filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function filters()
136136

137137
/**
138138
* @param string $name
139-
* @return null|CrudFilter
139+
* @return ?CrudFilter
140140
*/
141141
public function getFilter($name)
142142
{

src/app/Library/CrudPanel/Traits/Input.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait Input
1717
* Returns the direct inputs parsed for model and relationship creation.
1818
*
1919
* @param array $inputs
20-
* @param null|array $relationDetails
20+
* @param ?array $relationDetails
2121
* @param bool|string $relationMethod
2222
* @return array
2323
*/

src/app/Library/Uploaders/Support/RegisterUploadEvents.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(
2525
}
2626
}
2727

28-
public static function handle(CrudField|CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null, ?bool $registerModelEvents = true): void
28+
public static function handle(CrudField|CrudColumn $crudObject, array $uploaderConfiguration, string $macro, ?array $subfield = null, bool $registerModelEvents = true): void
2929
{
3030
$instance = new self($crudObject, $uploaderConfiguration, $macro);
3131

@@ -35,7 +35,7 @@ public static function handle(CrudField|CrudColumn $crudObject, array $uploaderC
3535
/*******************************
3636
* Private methods - implementation
3737
*******************************/
38-
private function registerEvents(array|null $subfield = [], ?bool $registerModelEvents = true): void
38+
private function registerEvents(?array $subfield = [], bool $registerModelEvents = true): void
3939
{
4040
if (! empty($subfield)) {
4141
$this->registerSubfieldEvent($subfield, $registerModelEvents);

src/app/Library/Uploaders/Support/Traits/HandleRepeatableUploads.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait HandleRepeatableUploads
1818
{
1919
public bool $handleRepeatableFiles = false;
2020

21-
public null|string $repeatableContainerName = null;
21+
public ?string $repeatableContainerName = null;
2222

2323
/*******************************
2424
* Setters - fluently configure the uploader
@@ -35,7 +35,7 @@ public function repeats(string $repeatableContainerName): self
3535
/*******************************
3636
* Getters
3737
*******************************/
38-
public function getRepeatableContainerName(): null|string
38+
public function getRepeatableContainerName(): ?string
3939
{
4040
return $this->repeatableContainerName;
4141
}

src/app/Library/Uploaders/Support/UploadersRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function getFieldUploaderInstance(string $requestInputName): UploaderInte
200200
/**
201201
* Get the upload field macro type for the given object.
202202
*/
203-
private function getUploadCrudObjectMacroType(array $crudObject): string|null
203+
private function getUploadCrudObjectMacroType(array $crudObject): ?string
204204
{
205205
$uploadersGroups = $this->getUploadersGroupsNames();
206206

src/app/Library/Validation/Rules/BackpackCustomRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected function validateOnSubmit(string $attribute, mixed $value): array
166166
return $this->validateRules($attribute, $value);
167167
}
168168

169-
protected function validateFieldAndFile(string $attribute, null|array $data = null, array|null $customRules = null): array
169+
protected function validateFieldAndFile(string $attribute, ?array $data = null, ?array $customRules = null): array
170170
{
171171
$fieldErrors = $this->validateFieldRules($attribute, $data, $customRules);
172172

@@ -178,7 +178,7 @@ protected function validateFieldAndFile(string $attribute, null|array $data = nu
178178
/**
179179
* Implementation.
180180
*/
181-
public function validateFieldRules(string $attribute, null|array|string|UploadedFile $data = null, array|null $customRules = null): array
181+
public function validateFieldRules(string $attribute, array|string|UploadedFile|null $data = null, ?array $customRules = null): array
182182
{
183183
$data = $data ?? $this->data;
184184
$validationRuleAttribute = $this->getValidationAttributeString($attribute);

0 commit comments

Comments
 (0)