Skip to content

Commit 4e757bd

Browse files
committed
fix: PHP 7.4 compatibility
Signed-off-by: Julius Härtl <[email protected]>
1 parent 635880a commit 4e757bd

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

lib/Service/CardService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
lib/Service/CardService.php<?php
1+
<?php
22
/**
33
* @copyright Copyright (c) 2016 Julius Härtl <[email protected]>
44
*
@@ -264,7 +264,7 @@ public function delete($id) {
264264
public function update($id, $title, $stackId, $type, $owner, $description = '', $order = 0, $duedate = null, $deletedAt = null, $archived = null) {
265265
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order'));
266266

267-
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, allowDeletedCard: true);
267+
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, null, true);
268268
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
269269

270270
if ($this->boardService->isArchived($this->cardMapper, $id)) {

lib/Service/CommentService.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ public function list(string $cardId, int $limit = 20, int $offset = 0): DataResp
8383
}
8484

8585
/**
86-
* @param string $cardId
87-
* @param string $message
88-
* @param string $replyTo
89-
* @return DataResponse
9086
* @throws BadRequestException
9187
* @throws NotFoundException|NoPermissionException
9288
*/
@@ -142,7 +138,7 @@ public function update(string $cardId, string $commentId, string $message): Data
142138
throw new NoPermissionException('Only authors are allowed to edit their comment.');
143139
}
144140
if ($comment->getParentId() !== '0') {
145-
$this->permissionService->checkPermission($this->cardMapper, $comment->getParentId(), Acl::PERMISSION_READ);
141+
$this->permissionService->checkPermission($this->cardMapper, (int)$comment->getParentId(), Acl::PERMISSION_READ);
146142
}
147143

148144
$comment->setMessage($message);

lib/Service/PermissionService.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ public function __construct(
9898
* @param $boardId
9999
* @return bool|array
100100
*/
101-
public function getPermissions($boardId) {
101+
public function getPermissions($boardId, ?string $userId = null) {
102+
if ($userId === null) {
103+
$userId = $this->userId;
104+
}
105+
102106
if ($cached = $this->permissionCache->get($boardId)) {
103107
return $cached;
104108
}
@@ -169,7 +173,7 @@ public function checkPermission($mapper, $id, $permission, $userId = null, bool
169173
}
170174

171175
try {
172-
$acls = $this->getBoard($boardId)->getAcl() ?? [];
176+
$acls = $this->getBoard((int)$boardId)->getAcl() ?? [];
173177
$result = $this->userCan($acls, $permission, $userId);
174178
if ($result) {
175179
return true;

tests/integration/features/bootstrap/BoardContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class BoardContext implements Context {
1919
private $storedCards = [];
2020
private $activities = null;
2121

22-
private ServerContext $serverContext;
22+
private $serverContext;
2323

2424
/** @BeforeScenario */
2525
public function gatherContexts(BeforeScenarioScope $scope) {

tests/integration/features/bootstrap/ServerContext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ class ServerContext implements Context {
1010
WebDav::__construct as private __tConstruct;
1111
}
1212

13-
private string $rawBaseUrl;
14-
private string $mappedUserId;
15-
private array $lastInsertIds = [];
13+
private $rawBaseUrl;
14+
private $mappedUserId;
15+
private $lastInsertIds = [];
1616

1717
public function __construct($baseUrl) {
1818
$this->rawBaseUrl = $baseUrl;

0 commit comments

Comments
 (0)