Skip to content

Commit 909f010

Browse files
FaustoJohnmarkharding
authored andcommitted
(feat): Upgrade php version to 8.1 minds/engine#2211
1 parent 0499722 commit 909f010

File tree

196 files changed

+4260
-4624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+4260
-4624
lines changed

.gitlab-ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ stages:
1515
- deploy:production
1616
- scan
1717

18+
variables:
19+
default_php_image: minds/php:8.1
20+
1821
baseimage:prepare:
1922
stage: baseimage
2023
image: minds/ci:latest
@@ -53,7 +56,7 @@ baseimage:deploy:
5356

5457
build:
5558
stage: build
56-
image: minds/php:pdo
59+
image: "$default_php_image"
5760
script:
5861
- apk add --no-cache git
5962
- sh tools/setup.sh production
@@ -65,19 +68,19 @@ build:
6568

6669
test:
6770
stage: test
68-
image: minds/php:pdo
71+
image: "$default_php_image"
6972
script:
7073
- php -n -c Spec/php-test.ini bin/phpspec run
7174

7275
lint:
7376
stage: test
74-
image: minds/php:pdo
77+
image: "$default_php_image"
7578
script:
7679
- bin/php-cs-fixer fix --allow-risky=yes --verbose --dry-run
7780

7881
static-analysis:
7982
stage: test
80-
image: minds/php:pdo
83+
image: "$default_php_image"
8184
script:
8285
- mv settings.example.php settings.php
8386
- bin/phpstan analyse --memory-limit=1G

Api/Exportable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct($items = [])
7979
* Exports the items
8080
* @return array
8181
*/
82-
public function export()
82+
public function export(): array
8383
{
8484
if (!$this->items || (!is_array($this->items) && !($this->items instanceof \Iterator))) {
8585
return [];
@@ -152,11 +152,11 @@ public function export()
152152
/**
153153
* Specify data which should be serialized to JSON
154154
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
155-
* @return mixed data which can be serialized by <b>json_encode</b>,
155+
* @return array data which can be serialized by <b>json_encode</b>,
156156
* which is a value of any type other than a resource.
157157
* @since 5.4.0
158158
*/
159-
public function jsonSerialize()
159+
public function jsonSerialize(): array
160160
{
161161
return $this->export();
162162
}

Common/Repository/Response.php

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ public function __construct(array $data = null, $pagingToken = null)
3737

3838
/**
3939
* Sets the paging token for this result set
40-
* @param string $pagingToken
40+
* @param string|null $pagingToken
4141
* @return Response
4242
*/
43-
public function setPagingToken($pagingToken)
43+
public function setPagingToken(?string $pagingToken): self
4444
{
4545
$this->pagingToken = $pagingToken;
4646
return $this;
4747
}
4848

4949
/**
5050
* Gets the paging token for this result set
51-
* @return string
51+
* @return string|null
5252
*/
53-
public function getPagingToken()
53+
public function getPagingToken(): ?string
5454
{
5555
return $this->pagingToken;
5656
}
@@ -60,7 +60,7 @@ public function getPagingToken()
6060
* @param Exception $exception
6161
* @return Response
6262
*/
63-
public function setException($exception)
63+
public function setException(Exception $exception): self
6464
{
6565
$this->exception = $exception;
6666
return $this;
@@ -70,7 +70,7 @@ public function setException($exception)
7070
* Gets the exception for a faulty result set
7171
* @return Exception
7272
*/
73-
public function getException()
73+
public function getException(): Exception
7474
{
7575
return $this->exception;
7676
}
@@ -80,7 +80,7 @@ public function getException()
8080
* @param bool $lastPage
8181
* @return Response
8282
*/
83-
public function setLastPage($lastPage)
83+
public function setLastPage(bool $lastPage): self
8484
{
8585
$this->lastPage = $lastPage;
8686
return $this;
@@ -90,16 +90,16 @@ public function setLastPage($lastPage)
9090
* Returns if it's the last page of a response
9191
* @return bool
9292
*/
93-
public function isLastPage()
93+
public function isLastPage(): bool
9494
{
9595
return !!$this->lastPage;
9696
}
9797

9898
/**
99-
* Returns if the result set is fauly
99+
* Returns if the result set is faulty
100100
* @return bool
101101
*/
102-
public function hasFailed()
102+
public function hasFailed(): bool
103103
{
104104
return !!$this->exception;
105105
}
@@ -110,7 +110,7 @@ public function hasFailed()
110110
* @return mixed Can return any type.
111111
* @since 5.0.0
112112
*/
113-
public function current()
113+
public function current(): mixed
114114
{
115115
return current($this->data);
116116
}
@@ -121,7 +121,7 @@ public function current()
121121
* @return void Any returned value is ignored.
122122
* @since 5.0.0
123123
*/
124-
public function next()
124+
public function next(): void
125125
{
126126
next($this->data);
127127
}
@@ -132,19 +132,19 @@ public function next()
132132
* @return mixed scalar on success, or null on failure.
133133
* @since 5.0.0
134134
*/
135-
public function key()
135+
public function key(): mixed
136136
{
137137
return key($this->data);
138138
}
139139

140140
/**
141141
* Checks if current position is valid
142142
* @link http://php.net/manual/en/iterator.valid.php
143-
* @return boolean The return value will be casted to boolean and then evaluated.
143+
* @return bool The return value will be casted to boolean and then evaluated.
144144
* Returns true on success or false on failure.
145145
* @since 5.0.0
146146
*/
147-
public function valid()
147+
public function valid(): bool
148148
{
149149
return key($this->data) !== null;
150150
}
@@ -155,7 +155,7 @@ public function valid()
155155
* @return void Any returned value is ignored.
156156
* @since 5.0.0
157157
*/
158-
public function rewind()
158+
public function rewind(): void
159159
{
160160
reset($this->data);
161161
}
@@ -164,7 +164,7 @@ public function rewind()
164164
* Rewinds the Iterator to the first element and returns its value
165165
* @return mixed
166166
*/
167-
public function reset()
167+
public function reset(): mixed
168168
{
169169
return reset($this->data);
170170
}
@@ -173,7 +173,7 @@ public function reset()
173173
* Sets the pointer onto the last Iterator element and returns its value
174174
* @return mixed
175175
*/
176-
public function end()
176+
public function end(): mixed
177177
{
178178
return end($this->data);
179179
}
@@ -184,13 +184,13 @@ public function end()
184184
* @param mixed $offset <p>
185185
* An offset to check for.
186186
* </p>
187-
* @return boolean true on success or false on failure.
187+
* @return bool true on success or false on failure.
188188
* </p>
189189
* <p>
190-
* The return value will be casted to boolean if non-boolean was returned.
190+
* The return value will be cast to boolean if non-boolean was returned.
191191
* @since 5.0.0
192192
*/
193-
public function offsetExists($offset)
193+
public function offsetExists(mixed $offset): bool
194194
{
195195
return isset($this->data[$offset]);
196196
}
@@ -204,7 +204,7 @@ public function offsetExists($offset)
204204
* @return mixed Can return all value types.
205205
* @since 5.0.0
206206
*/
207-
public function offsetGet($offset)
207+
public function offsetGet(mixed $offset): mixed
208208
{
209209
return $this->data[$offset];
210210
}
@@ -221,7 +221,7 @@ public function offsetGet($offset)
221221
* @return void
222222
* @since 5.0.0
223223
*/
224-
public function offsetSet($offset, $value)
224+
public function offsetSet(mixed $offset, mixed $value): void
225225
{
226226
if ($offset === null) {
227227
$this->data[] = $value;
@@ -240,7 +240,7 @@ public function offsetSet($offset, $value)
240240
* @return void
241241
* @since 5.0.0
242242
*/
243-
public function offsetUnset($offset)
243+
public function offsetUnset(mixed $offset): void
244244
{
245245
unset($this->data[$offset]);
246246
}
@@ -254,7 +254,7 @@ public function offsetUnset($offset)
254254
* The return value is cast to an integer.
255255
* @since 5.1.0
256256
*/
257-
public function count()
257+
public function count(): int
258258
{
259259
return count($this->data);
260260
}
@@ -263,7 +263,7 @@ public function count()
263263
* @param array $data
264264
* @return Response
265265
*/
266-
public function pushArray(array $data)
266+
public function pushArray(array $data): self
267267
{
268268
array_push($this->data, ...$data);
269269
return $this;
@@ -285,28 +285,29 @@ public function prependToArray(array $data): self
285285
* Exports the data array
286286
* @return array
287287
*/
288-
public function toArray()
288+
public function toArray(): array
289289
{
290290
return $this->data ?: [];
291291
}
292292

293293
/**
294294
* Specify data which should be serialized to JSON
295295
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
296-
* @return mixed data which can be serialized by <b>json_encode</b>,
296+
* @return array data which can be serialized by <b>json_encode</b>,
297297
* which is a value of any type other than a resource.
298298
* @since 5.4.0
299299
*/
300-
public function jsonSerialize()
300+
public function jsonSerialize(): array
301301
{
302302
return $this->toArray();
303303
}
304304

305305
/**
306306
* Returns a clone of this response with the inverse order
307+
* @param bool $preserveKeys
307308
* @return Response
308309
*/
309-
public function reverse($preserveKeys = false)
310+
public function reverse(bool $preserveKeys = false): self
310311
{
311312
return new self(array_reverse($this->data, $preserveKeys), $this->pagingToken);
312313
}
@@ -319,7 +320,7 @@ public function reverse($preserveKeys = false)
319320
* @param bool $preserveKeys
320321
* @return Response
321322
*/
322-
public function filter($callback, $preserveKeys = false)
323+
public function filter(callable $callback, bool $preserveKeys = false): self
323324
{
324325
$filtered = array_filter($this->data, $callback, ARRAY_FILTER_USE_BOTH);
325326

@@ -335,7 +336,7 @@ public function filter($callback, $preserveKeys = false)
335336
* @param callable $callback
336337
* @return Response
337338
*/
338-
public function map($callback)
339+
public function map(callable $callback): self
339340
{
340341
return new self(array_map($callback, $this->data), $this->pagingToken);
341342
}
@@ -346,7 +347,7 @@ public function map($callback)
346347
* @param mixed $initialValue
347348
* @return mixed
348349
*/
349-
public function reduce($callback, $initialValue = null)
350+
public function reduce(callable $callback, mixed $initialValue = null): mixed
350351
{
351352
return array_reduce($this->data, $callback, $initialValue);
352353
}
@@ -367,7 +368,7 @@ public function sort(callable $callback): Response
367368
* Returns the first element of the Response, or null if empty
368369
* @return mixed|null
369370
*/
370-
public function first()
371+
public function first(): mixed
371372
{
372373
return $this->data[0] ?? null;
373374
}
@@ -376,7 +377,7 @@ public function first()
376377
* Returns the last element
377378
* @return mixed | null
378379
*/
379-
public function last()
380+
public function last(): mixed
380381
{
381382
$count = count($this->data);
382383
return $this->data[$count - 1] ?? null;

Common/Urn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function __toString()
124124
* which is a value of any type other than a resource.
125125
* @since 5.4.0
126126
*/
127-
public function jsonSerialize()
127+
public function jsonSerialize(): mixed
128128
{
129129
return $this->urn;
130130
}

Controllers/Cli/Analytics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function help($command = null)
3131
$this->out('Prints the counts of a user');
3232
$this->out('--from={timestamp in milliseconds} the day to start count. Default is yesterday');
3333
$this->out('--guid={user guid} REQUIRED the user to aggregate');
34-
// no break
34+
// no break
3535
default:
3636
$this->out('Syntax usage: cli analytics <type>');
3737
$this->displayCommandHelp();

Controllers/Cli/EventStreams.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private function onBatchConsumed(bool $isBatch, BatchSubscriptionInterface|Subsc
109109

110110
return match ($isBatch) {
111111
true => function () use ($subscription): void {
112-
$subscription->commitChanges();
112+
$subscription->onBatchConsumed();
113113
},
114114
default => null
115115
};

Controllers/Cli/Notification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function help($command = null)
2828
$this->out('--from=<entity guid> Entity notification is from (defaults to system user)');
2929
$this->out('--view=<view> Notification view');
3030
$this->out('--params=<params> JSON payload data');
31-
// no break
31+
// no break
3232
default:
3333
$this->out('Syntax usage: cli notification <cmd>');
3434
$this->displayCommandHelp();

0 commit comments

Comments
 (0)