Skip to content

Commit b933f48

Browse files
committed
test: adjust PHP code to support v8.4
The implicite nullable type has been deprecated. This fixes it by explicitely typing every nullable type. PHP is also bumped in composer and drone to v8.4.
1 parent 9031871 commit b933f48

20 files changed

+65
-50
lines changed

.drone.star

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:11.0"
4040
KEYCLOAK_IMAGE = "quay.io/keycloak/keycloak:26.2.5"
4141
POSTGRES_ALPINE_IMAGE = "postgres:alpine3.18"
4242

43-
DEFAULT_PHP_VERSION = "8.2"
43+
DEFAULT_PHP_VERSION = "8.4"
4444
DEFAULT_NODEJS_VERSION = "22"
4545

4646
dirs = {
@@ -1010,6 +1010,9 @@ def codestyle(ctx):
10101010
{
10111011
"name": "php-style",
10121012
"image": OC_CI_PHP % phpVersion,
1013+
"environment": {
1014+
"PHP_CS_FIXER_IGNORE_ENV": "true",
1015+
},
10131016
"commands": [
10141017
"make test-php-style",
10151018
],

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "owncloud/ocis",
3-
"config" : {
3+
"config": {
44
"platform": {
5-
"php": "8.2"
5+
"php": "8.4"
66
},
77
"vendor-dir": "./vendor-php",
88
"allow-plugins": {
@@ -18,4 +18,4 @@
1818
"bin-links": false
1919
}
2020
}
21-
}
21+
}

tests/acceptance/TestHelpers/SharingHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function createShare(
9999
$shareType,
100100
?string $shareWith = null,
101101
?bool $publicUpload = false,
102-
string $sharePassword = null,
102+
?string $sharePassword = null,
103103
$permissions = null,
104104
?string $linkName = null,
105105
?string $expireDate = null,

tests/acceptance/bootstrap/CliContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ protected function listTrashedResource(string $spaceId): ResponseInterface {
719719
* @return array
720720
*/
721721
protected function getTrashedResourceFromCliCommandResponse(
722-
ResponseInterface $response = null,
722+
?ResponseInterface $response = null,
723723
): array {
724724
$responseArray = $this->featureContext->getJsonDecodedResponseBodyContent($response);
725725
$lines = explode("\n", $responseArray->message);

tests/acceptance/bootstrap/CollaborationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function userChecksTheInformationOfFileOfSpaceUsingOffice(
9191
string $file,
9292
string $space,
9393
string $app,
94-
string $viewMode = null,
94+
?string $viewMode = null,
9595
): void {
9696
$fileId = $this->spacesContext->getFileId($user, $space, $file);
9797
$response = \json_decode(

tests/acceptance/bootstrap/FavoritesContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class FavoritesContext implements Context {
4343
*
4444
* @return ResponseInterface
4545
*/
46-
public function userFavoritesElement(string $user, string $path, string $spaceId = null): ResponseInterface {
46+
public function userFavoritesElement(string $user, string $path, ?string $spaceId = null): ResponseInterface {
4747
return $this->changeFavStateOfAnElement(
4848
$user,
4949
$path,
@@ -179,7 +179,7 @@ public function asUserFileOrFolderShouldBeFavorited(
179179
string $user,
180180
string $path,
181181
int $expectedValue = 1,
182-
string $spaceId = null,
182+
?string $spaceId = null,
183183
): void {
184184
$property = "oc:favorite";
185185
$this->webDavPropertiesContext->checkPropertyOfAFolder(

tests/acceptance/bootstrap/FeatureContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ public function getJSONSchema($schemaString): mixed {
15831583
*
15841584
* @return mixed
15851585
*/
1586-
public function getJsonDecodedResponseBodyContent(ResponseInterface $response = null): mixed {
1586+
public function getJsonDecodedResponseBodyContent(?ResponseInterface $response = null): mixed {
15871587
$response = $response ?? $this->response;
15881588
$response->getBody()->rewind();
15891589
return HttpRequestHelper::getJsonDecodedResponseBodyContent($response);

tests/acceptance/bootstrap/GraphContext.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ public function theUserInformationShouldMatchTheJSON(string $user, PyStringNode
205205
public function editUserUsingTheGraphApi(
206206
string $byUser,
207207
string $user,
208-
string $userName = null,
209-
string $password = null,
210-
string $email = null,
211-
string $displayName = null,
208+
?string $userName = null,
209+
?string $password = null,
210+
?string $email = null,
211+
?string $displayName = null,
212212
bool $accountEnabled = true,
213213
string $method = "PATCH",
214214
): ResponseInterface {
@@ -2342,7 +2342,7 @@ public function userGeneratesGDPRReportOfOwnDataToPath(string $user, string $pat
23422342
public function downloadedJsonContentShouldContainEventTypeInItemAndShouldMatch(
23432343
string $eventType,
23442344
?string $spaceType = null,
2345-
PyStringNode $schemaString = null,
2345+
?PyStringNode $schemaString = null,
23462346
): void {
23472347
$actualResponseToAssert = null;
23482348
$events = $this->featureContext->getJsonDecodedResponseBodyContent()->events;

tests/acceptance/bootstrap/OcmContext.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,17 @@ public function getLastFederatedInvitationToken(): string {
7373

7474
/**
7575
* @param string $user
76-
* @param string $email
77-
* @param string $description
76+
* @param string|null $email
77+
* @param string|null $description
7878
*
7979
* @return ResponseInterface
8080
* @throws GuzzleException
8181
*/
82-
public function createInvitation(string $user, $email = null, $description = null): ResponseInterface {
82+
public function createInvitation(
83+
string $user,
84+
?string $email = null,
85+
?string $description = null,
86+
): ResponseInterface {
8387
$response = OcmHelper::createInvitation(
8488
$this->featureContext->getBaseUrl(),
8589
$user,
@@ -99,13 +103,17 @@ public function createInvitation(string $user, $email = null, $description = nul
99103
* @When :user creates the federation share invitation with email :email and description :description
100104
*
101105
* @param string $user
102-
* @param string $email
103-
* @param string $description
106+
* @param string|null $email
107+
* @param string|null $description
104108
*
105109
* @return void
106110
* @throws GuzzleException
107111
*/
108-
public function userCreatesTheFederationShareInvitation(string $user, $email = null, $description = null): void {
112+
public function userCreatesTheFederationShareInvitation(
113+
string $user,
114+
?string $email = null,
115+
?string $description = null,
116+
): void {
109117
$this->featureContext->setResponse($this->createInvitation($user, $email, $description));
110118
}
111119

@@ -114,25 +122,29 @@ public function userCreatesTheFederationShareInvitation(string $user, $email = n
114122
* @Given :user has created the federation share invitation with email :email and description :description
115123
*
116124
* @param string $user
117-
* @param string $email
118-
* @param string $description
125+
* @param string|null $email
126+
* @param string|null $description
119127
*
120128
* @return void
121129
* @throws GuzzleException
122130
*/
123-
public function userHasCreatedTheFederationShareInvitation(string $user, $email = null, $description = null): void {
131+
public function userHasCreatedTheFederationShareInvitation(
132+
string $user,
133+
?string $email = null,
134+
?string $description = null,
135+
): void {
124136
$response = $this->createInvitation($user, $email, $description);
125137
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
126138
}
127139

128140
/**
129141
* @param string $user
130-
* @param string $token
142+
* @param string|null $token
131143
*
132144
* @return ResponseInterface
133145
* @throws GuzzleException
134146
*/
135-
public function acceptInvitation(string $user, string $token = null): ResponseInterface {
147+
public function acceptInvitation(string $user, ?string $token = null): ResponseInterface {
136148
$providerDomain = $this->featureContext->getLocalBaseUrlWithoutScheme();
137149
if ($this->featureContext->getCurrentServer() === "LOCAL") {
138150
$providerDomain = $this->featureContext->getRemoteBaseUrlWithoutScheme();
@@ -350,7 +362,7 @@ public function userHasDeletedFederatedConnectionWithUser(string $user, string $
350362
* @return ResponseInterface
351363
* @throws GuzzleException
352364
*/
353-
public function deleteConnection(string $user, string $ocmUser, string $idp = null): ResponseInterface {
365+
public function deleteConnection(string $user, string $ocmUser, ?string $idp = null): ResponseInterface {
354366
$ocmUser = $this->getAcceptedUserByName($user, $ocmUser);
355367
$ocmUser['idp'] = $idp ?? $ocmUser['idp'];
356368
return OcmHelper::deleteConnection(

tests/acceptance/bootstrap/Provisioning.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ public function rememberThatUserIsNotExpectedToExist(string $user): void {
10551055
*/
10561056
public function userHasBeenCreated(
10571057
array $userData,
1058-
string $byUser = null,
1058+
?string $byUser = null,
10591059
): void {
10601060
$userId = null;
10611061

0 commit comments

Comments
 (0)