Skip to content

Commit 9c1d7be

Browse files
committed
Fixed PHP 8.4 deprecations
1 parent 5eaac70 commit 9c1d7be

File tree

8 files changed

+896
-1494
lines changed

8 files changed

+896
-1494
lines changed

composer.lock

Lines changed: 882 additions & 1479 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Classes/Bulk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function getIndex(): string|null
151151
#[Deprecated(reason: 'Mapping types are deprecated as of Elasticsearch 7.0.0')]
152152
protected function getType(): string|null
153153
{
154-
return $this->type ?: $this->query->getType();
154+
return $this->type;
155155
}
156156

157157
/**

src/Classes/Search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Search
6262
public function __construct(
6363
Query $query,
6464
string $queryString,
65-
callable|array $settings = null
65+
callable|array|null $settings = null
6666
) {
6767
$this->query = $query;
6868
$this->queryString = $queryString;

src/Concerns/AppliesScopes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function withGlobalScope(
191191
*
192192
* @return $this
193193
*/
194-
public function withoutGlobalScopes(array $scopes = null): static
194+
public function withoutGlobalScopes(array|null $scopes = null): static
195195
{
196196
if (!is_array($scopes)) {
197197
$scopes = array_keys($this->scopes);

src/Concerns/BuildsFluentQueries.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ public function id(string|null $id = null): static
384384
*/
385385
public function aggregate(
386386
string $name,
387-
array|string $settings = null
387+
array|string|null $settings = null
388388
): static {
389389
$field = is_string($settings) ? $settings : $name;
390390
$settings = is_array($settings)
@@ -1007,7 +1007,7 @@ public function scrollId(string|null $scroll): static
10071007
*/
10081008
public function search(
10091009
string|null $queryString = null,
1010-
callable|array $settings = null,
1010+
callable|array|null $settings = null,
10111011
int|null $boost = null
10121012
): static {
10131013
if ($queryString) {

src/Concerns/ExecutesQueries.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private function addBaseParams(array $params): array
213213
*/
214214
public function update(
215215
array $attributes,
216-
int|string $id = null
216+
int|string|null $id = null
217217
): object {
218218
if ($id) {
219219
$this->id((string)$id);
@@ -280,7 +280,7 @@ public function delete(string|null $id = null): object
280280
* @noinspection PhpDocSignatureInspection
281281
*/
282282
public function firstOr(
283-
callable|string $scrollId = null,
283+
callable|string|null $scrollId = null,
284284
callable|null $callback = null
285285
): Model|null {
286286
if (is_callable($scrollId)) {
@@ -480,7 +480,6 @@ protected function createModelInstance(array $document): Model
480480
$metadata,
481481
true,
482482
$document[Query::FIELD_INDEX] ?? null,
483-
$document[Query::FIELD_TYPE] ?? null,
484483
);
485484
}
486485

src/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Connection implements ConnectionInterface
5353
* @todo remove in next major version
5454
*/
5555
#[Deprecated]
56-
private static Resolver $resolver;
56+
protected static Resolver $resolver;
5757

5858
/**
5959
* Cache instance to be used for this connection. In Laravel applications,

src/Model.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
/**
5959
* Elasticsearch data model
6060
*
61-
* @property-read string|null _id
62-
* @property-read string|null _index
63-
* @property-read string|null _type
64-
* @property-read float|null _score
65-
* @property-read array|null highlight
61+
* @property-read string|null $_id
62+
* @property-read string|null $_index
63+
* @property-read string|null $_type
64+
* @property-read float|null $_score
65+
* @property-read array|null $highlight
6666
*
6767
* @package Matchory\Elasticsearch
6868
*/
@@ -1556,7 +1556,7 @@ public function offsetSet(mixed $offset, mixed $value): void
15561556
*
15571557
* @return static
15581558
*/
1559-
public function replicate(array $except = null): self
1559+
public function replicate(array|null $except = null): self
15601560
{
15611561
$defaults = [
15621562
self::FIELD_ID,

0 commit comments

Comments
 (0)