From c8fe75da0fbf330e43fd3119c56d5cc74b02c0b0 Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Sat, 13 Jul 2024 21:19:15 +0200 Subject: [PATCH] Prepare for PHP 8.4 --- src/HasJsonRelationships.php | 6 +++--- src/Relations/BelongsToJson.php | 2 +- src/Relations/Postgres/HasOneOrManyThrough.php | 2 +- .../Concatenation/IsConcatenableBelongsToJsonRelation.php | 2 +- .../Concatenation/IsConcatenableHasManyJsonRelation.php | 2 +- src/Relations/Traits/IsJsonRelation.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/HasJsonRelationships.php b/src/HasJsonRelationships.php index acd2c85..568fc9b 100644 --- a/src/HasJsonRelationships.php +++ b/src/HasJsonRelationships.php @@ -322,9 +322,9 @@ public function hasManyThroughJson( string $related, string $through, string|JsonKey $firstKey, - string $secondKey = null, - string $localKey = null, - string|JsonKey $secondLocalKey = null + ?string $secondKey = null, + ?string $localKey = null, + string|JsonKey|null $secondLocalKey = null ) { $relationships = []; diff --git a/src/Relations/BelongsToJson.php b/src/Relations/BelongsToJson.php index 4c72878..7feb6a3 100644 --- a/src/Relations/BelongsToJson.php +++ b/src/Relations/BelongsToJson.php @@ -328,7 +328,7 @@ public function pivotAttributes(Model $model, Model $parent, array $records) * @param \Illuminate\Database\Eloquent\Model|null $model * @return array */ - public function getForeignKeys(Model $model = null) + public function getForeignKeys(?Model $model = null) { $model = $model ?: $this->child; diff --git a/src/Relations/Postgres/HasOneOrManyThrough.php b/src/Relations/Postgres/HasOneOrManyThrough.php index bdf1489..719a570 100644 --- a/src/Relations/Postgres/HasOneOrManyThrough.php +++ b/src/Relations/Postgres/HasOneOrManyThrough.php @@ -14,7 +14,7 @@ trait HasOneOrManyThrough * @param \Illuminate\Database\Eloquent\Builder|null $query * @return void */ - protected function performJoin(Builder $query = null) + protected function performJoin(?Builder $query = null) { $query = $query ?: $this->query; diff --git a/src/Relations/Traits/Concatenation/IsConcatenableBelongsToJsonRelation.php b/src/Relations/Traits/Concatenation/IsConcatenableBelongsToJsonRelation.php index 237448b..3550838 100644 --- a/src/Relations/Traits/Concatenation/IsConcatenableBelongsToJsonRelation.php +++ b/src/Relations/Traits/Concatenation/IsConcatenableBelongsToJsonRelation.php @@ -24,7 +24,7 @@ public function appendToDeepRelationship(array $through, array $foreignKeys, arr if ($position === 0) { $foreignKeys[] = $this->ownerKey; - $localKeys[] = function (Builder $query, Builder $parentQuery = null) { + $localKeys[] = function (Builder $query, ?Builder $parentQuery = null) { if ($parentQuery) { $this->getRelationExistenceQuery($this->query, $parentQuery); } diff --git a/src/Relations/Traits/Concatenation/IsConcatenableHasManyJsonRelation.php b/src/Relations/Traits/Concatenation/IsConcatenableHasManyJsonRelation.php index 6cfbf53..895b364 100644 --- a/src/Relations/Traits/Concatenation/IsConcatenableHasManyJsonRelation.php +++ b/src/Relations/Traits/Concatenation/IsConcatenableHasManyJsonRelation.php @@ -25,7 +25,7 @@ trait IsConcatenableHasManyJsonRelation public function appendToDeepRelationship(array $through, array $foreignKeys, array $localKeys, int $position): array { if ($position === 0) { - $foreignKeys[] = function (Builder $query, Builder $parentQuery = null) { + $foreignKeys[] = function (Builder $query, ?Builder $parentQuery = null) { if ($parentQuery) { $this->getRelationExistenceQuery($this->query, $parentQuery); } diff --git a/src/Relations/Traits/IsJsonRelation.php b/src/Relations/Traits/IsJsonRelation.php index ec6a817..7d61643 100644 --- a/src/Relations/Traits/IsJsonRelation.php +++ b/src/Relations/Traits/IsJsonRelation.php @@ -117,7 +117,7 @@ protected function whereJsonContainsOrMemberOf( Builder $query, string $column, mixed $value, - callable $objectValueCallback = null, + ?callable $objectValueCallback = null, string $boolean = 'and' ): void { $grammar = $this->getJsonGrammar($query);