Skip to content

Commit dc532bd

Browse files
committed
PHP 8.4 updates
1 parent 54ca55b commit dc532bd

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^8.0",
19+
"php": "^8.2",
2020
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
2121
"illuminate/database": "^8.0|^9.0|^10.0|^11.0",
2222
"illuminate/cache": "^8.0|^9.0|^10.0|^11.0"
2323
},
2424
"require-dev": {
2525
"phpunit/phpunit": "^9.0",
2626
"mockery/mockery": "^1.4",
27-
"phpstan/phpstan": "^1.6",
27+
"phpstan/phpstan": "^2.0",
2828
"squizlabs/php_codesniffer": "^3.6"
2929
},
3030
"autoload": {

src/Concerns/Cacheable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function skippedCache(): bool
6767
*
6868
* @return string
6969
*/
70-
public function getCacheKey(string $method, array $args = null, string $tag = ''): string
70+
public function getCacheKey(string $method, array|null $args = null, string $tag = ''): string
7171
{
7272
// Sort through arguments
7373
foreach ($args as &$a) {
@@ -98,7 +98,7 @@ public function getCacheKey(string $method, array $args = null, string $tag = ''
9898
*
9999
* @return mixed
100100
*/
101-
public function cacheCallback(string $method, array $args, Closure $callback, int $time = null): mixed
101+
public function cacheCallback(string $method, array $args, Closure $callback, int|null $time = null): mixed
102102
{
103103
// Cache disabled, just execute query & return result
104104
if ($this->skippedCache() === true) {

src/Concerns/Messages.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function hasMessage(string $key = 'message'): bool
4141
/**
4242
* {@inheritDoc}
4343
*/
44-
public function getMessage(string $key = null, string $format = null, string $default = ''): string
44+
public function getMessage(string|null $key = null, string|null $format = null, string $default = ''): string
4545
{
4646
return $this->getMessageBag()->first($key, $format) ?: $default;
4747
}
@@ -67,7 +67,7 @@ public function hasErrors(): bool
6767
/**
6868
* {@inheritDoc}
6969
*/
70-
public function getErrors(string $format = null): array
70+
public function getErrors(string|null $format = null): array
7171
{
7272
return $this->getMessageBag()->get('error', $format);
7373
}

src/Concerns/Ordering.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ protected function applyOrderableScope(string $column, string $direction): stati
161161
* @return string
162162
*/
163163
public function addOrderByJoin(
164-
Builder $query,
165-
string $joining_table,
166-
string $foreign_key,
167-
string $related_key,
168-
string $alias = null
164+
Builder $query,
165+
string $joining_table,
166+
string $foreign_key,
167+
string $related_key,
168+
string|null $alias = null
169169
): string {
170170
// We need to join to the intermediate table
171171
$local_table = $this->getModel()->getTable();

src/Concerns/Scopes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function getScopeQuery(): array
9292
*
9393
* @return static
9494
*/
95-
public function addScopeQuery(Closure|Scope $scope, string $key = null): static
95+
public function addScopeQuery(Closure|Scope $scope, string|null $key = null): static
9696
{
9797
if ($scope instanceof Scope && $scope->shouldSkip()) {
9898
return $this;

src/Concerns/Searching.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ public function createSearchClause(
135135
* @return string
136136
*/
137137
public function addSearchJoin(
138-
Builder $query,
139-
string $joining_table,
140-
string $foreign_key,
141-
string $related_key,
142-
string $alias = null
138+
Builder $query,
139+
string $joining_table,
140+
string $foreign_key,
141+
string $related_key,
142+
string|null $alias = null
143143
): string {
144144
// We need to join to the intermediate table
145145
$local_table = $this->getModel()->getTable();

src/Contracts/Repository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function count(array $columns = ['*']): int;
120120
*
121121
* @return array<TKey, TValue>
122122
*/
123-
public function pluck(string $value, string $key = null): array;
123+
public function pluck(string $value, string|null $key = null): array;
124124

125125
/**
126126
* Retrieve all data of repository, paginated
@@ -205,7 +205,7 @@ public function hasMessage(string $key = 'message'): bool;
205205
*
206206
* @return string
207207
*/
208-
public function getMessage(string $key = null, string $format = null, string $default = ''): string;
208+
public function getMessage(string|null $key = null, string|null $format = null, string $default = ''): string;
209209

210210
/**
211211
* Add an error to the message bag

src/Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function count(array $columns = ['*']): int
219219
/**
220220
* {@inheritDoc}
221221
*/
222-
public function pluck(string $value, string $key = null): array
222+
public function pluck(string $value, string|null $key = null): array
223223
{
224224
$this->newQuery();
225225

0 commit comments

Comments
 (0)