refactor: add return type lint rules

Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
Saw-jan
2025-06-19 12:15:41 +05:45
parent 2ef566b85b
commit 2c6c769695
14 changed files with 99 additions and 80 deletions

View File

@@ -35,6 +35,8 @@ $config->setFinder($finder)
'no_singleline_whitespace_before_semicolons' => true,
'type_declaration_spaces' => true,
'binary_operator_spaces' => true,
'phpdoc_to_return_type' => true,
'void_return' => true,
]
)
);

View File

@@ -94,7 +94,7 @@ class OcisHelper {
/**
* @return bool|string false if no command given or the command as string
*/
public static function getDeleteUserDataCommand() {
public static function getDeleteUserDataCommand(): bool|string {
$cmd = \getenv("DELETE_USER_DATA_CMD");
if ($cmd === false || \trim($cmd) === "") {
return false;

View File

@@ -223,7 +223,7 @@ class CliContext implements Context {
*
* @return void
*/
public function theAdministratorRemovesAllVersionsOfResources() {
public function theAdministratorRemovesAllVersionsOfResources(): void {
$path = $this->featureContext->getStorageUsersRoot();
$command = "revisions purge -p $path --dry-run=false";
$body = [
@@ -241,7 +241,7 @@ class CliContext implements Context {
*
* @return void
*/
public function theAdministratorRemovesTheVersionsOfFileUsingFileId($file, $user, $space) {
public function theAdministratorRemovesTheVersionsOfFileUsingFileId($file, $user, $space): void {
$path = $this->featureContext->getStorageUsersRoot();
$fileId = $this->spacesContext->getFileId($user, $space, $file);
$command = "revisions purge -p $path -r $fileId --dry-run=false";

View File

@@ -609,7 +609,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAdminUsernameFromEnvironment() {
private static function getAdminUsernameFromEnvironment(): string|bool {
return \getenv('ADMIN_USERNAME');
}
@@ -618,7 +618,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAdminPasswordFromEnvironment() {
private static function getAdminPasswordFromEnvironment(): string|bool {
return \getenv('ADMIN_PASSWORD');
}
@@ -627,7 +627,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getRegularUserPasswordFromEnvironment() {
private static function getRegularUserPasswordFromEnvironment(): string|bool {
return \getenv('REGULAR_USER_PASSWORD');
}
@@ -636,7 +636,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAlt1UserPasswordFromEnvironment() {
private static function getAlt1UserPasswordFromEnvironment(): string|bool {
return \getenv('ALT1_USER_PASSWORD');
}
@@ -645,7 +645,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAlt2UserPasswordFromEnvironment() {
private static function getAlt2UserPasswordFromEnvironment(): string|bool {
return \getenv('ALT2_USER_PASSWORD');
}
@@ -654,7 +654,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAlt3UserPasswordFromEnvironment() {
private static function getAlt3UserPasswordFromEnvironment(): string|bool {
return \getenv('ALT3_USER_PASSWORD');
}
@@ -663,7 +663,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAlt4UserPasswordFromEnvironment() {
private static function getAlt4UserPasswordFromEnvironment(): string|bool {
return \getenv('ALT4_USER_PASSWORD');
}
@@ -672,7 +672,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getSubAdminPasswordFromEnvironment() {
private static function getSubAdminPasswordFromEnvironment(): string|bool {
return \getenv('SUB_ADMIN_PASSWORD');
}
@@ -681,7 +681,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getAlternateAdminPasswordFromEnvironment() {
private static function getAlternateAdminPasswordFromEnvironment(): string|bool {
return \getenv('ALTERNATE_ADMIN_PASSWORD');
}
@@ -690,7 +690,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string|false
*/
private static function getPublicLinkSharePasswordFromEnvironment() {
private static function getPublicLinkSharePasswordFromEnvironment(): string|bool {
return \getenv('PUBLIC_LINK_SHARE_PASSWORD');
}
@@ -1566,7 +1566,7 @@ class FeatureContext extends BehatVariablesContext {
*
* @return mixed
*/
public function getJSONSchema($schemaString) {
public function getJSONSchema($schemaString): mixed {
if (\gettype($schemaString) !== 'string') {
$schemaString = $schemaString->getRaw();
}

View File

@@ -500,7 +500,11 @@ class GraphContext implements Context {
* @return void
* @throws Exception
*/
public function theUserResetsThePasswordOfUserToUsingTheGraphApi(string $byUser, string $user, string $password) {
public function theUserResetsThePasswordOfUserToUsingTheGraphApi(
string $byUser,
string $user,
string $password
): void {
$response = $this->adminChangesPasswordOfUserToUsingTheGraphApi($user, $password, $byUser);
$this->featureContext->setResponse($response);
}
@@ -1370,7 +1374,7 @@ class GraphContext implements Context {
*
* @return void
*/
public function userTriesToGetOwnDriveInformation(string $user) {
public function userTriesToGetOwnDriveInformation(string $user): void {
$response = $this->retrieveUserInformationAlongWithDriveUsingGraphApi($user);
$this->featureContext->setResponse($response);
}
@@ -1591,7 +1595,7 @@ class GraphContext implements Context {
* @return void
* @throws GuzzleException
*/
public function userGetsAllApplicationsUsingTheGraphApi(string $user) {
public function userGetsAllApplicationsUsingTheGraphApi(string $user): void {
$response = GraphHelper::getApplications(
$this->featureContext->getBaseUrl(),
$user,
@@ -1660,7 +1664,7 @@ class GraphContext implements Context {
* @return void
* @throws GuzzleException
*/
public function userGetsAllUsersOfTheGroupUsingTheGraphApi(string $user, string $group) {
public function userGetsAllUsersOfTheGroupUsingTheGraphApi(string $user, string $group): void {
$groupId = $this->featureContext->getGroupIdByGroupName($group);
$response = GraphHelper::getUsersWithFilterMemberOf(
$this->featureContext->getBaseUrl(),
@@ -1680,7 +1684,7 @@ class GraphContext implements Context {
* @return void
* @throws GuzzleException
*/
public function userGetsAllUsersOfTwoGroupsUsingTheGraphApi(string $user, string $groups) {
public function userGetsAllUsersOfTwoGroupsUsingTheGraphApi(string $user, string $groups): void {
$groupsIdArray = [];
foreach (explode(',', $groups) as $group) {
$groupsIdArray[] = $this->featureContext->getGroupIdByGroupName($group);
@@ -1708,7 +1712,7 @@ class GraphContext implements Context {
string $user,
string $firstGroup,
string $secondGroup
) {
): void {
$response = GraphHelper::getUsersFromOneOrOtherGroup(
$this->featureContext->getBaseUrl(),
$user,
@@ -1753,7 +1757,7 @@ class GraphContext implements Context {
* @return void
* @throws GuzzleException
*/
public function userGetsAllUsersWithRoleUsingTheGraphApi(string $user, string $role) {
public function userGetsAllUsersWithRoleUsingTheGraphApi(string $user, string $role): void {
$response = GraphHelper::getUsersWithFilterRoleAssignment(
$this->featureContext->getBaseUrl(),
$user,
@@ -1777,7 +1781,7 @@ class GraphContext implements Context {
string $user,
string $role,
string $group
) {
): void {
$response = GraphHelper::getUsersWithFilterRolesAssignmentAndMemberOf(
$this->featureContext->getBaseUrl(),
$user,
@@ -2020,7 +2024,7 @@ class GraphContext implements Context {
string $user,
string $group,
TableNode $table
) {
): void {
$userIds = [];
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
foreach ($table->getHash() as $row) {
@@ -2046,7 +2050,7 @@ class GraphContext implements Context {
string $user,
string $groupToAdd,
string $group
) {
): void {
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
$groupIdToAdd = $this->featureContext->getAttributeOfCreatedGroup($groupToAdd, "id");
$credentials = $this->getAdminOrUserCredentials($user);
@@ -2083,7 +2087,7 @@ class GraphContext implements Context {
string $user,
string $groupToAdd,
string $group
) {
): void {
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
$groupIdToAdd = $this->featureContext->getAttributeOfCreatedGroup($groupToAdd, "id");
$credentials = $this->getAdminOrUserCredentials($user);
@@ -2202,7 +2206,7 @@ class GraphContext implements Context {
string $user,
string $group,
TableNode $table
) {
): void {
$userIds = [];
$credentials = $this->getAdminOrUserCredentials($user);
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
@@ -3220,7 +3224,11 @@ class GraphContext implements Context {
* @return void
* @throws GuzzleException
*/
public function userSearchesForUserOfTheGroupUsingTheGraphApi(string $user, string $searchTerm, string $group) {
public function userSearchesForUserOfTheGroupUsingTheGraphApi(
string $user,
string $searchTerm,
string $group
): void {
$groupId = $this->featureContext->getGroupIdByGroupName($group);
$response = GraphHelper::searchUserWithFilterMemberOf(
$this->featureContext->getBaseUrl(),

View File

@@ -557,7 +557,7 @@ class NotificationContext implements Context {
* @throws GuzzleException
* @throws JsonException
*/
public function theAdministratorCreatesADeprovisioningNotification(?string $user = null) {
public function theAdministratorCreatesADeprovisioningNotification(?string $user = null): void {
$response = $this->userCreatesDeprovisioningNotification($user);
$this->featureContext->setResponse($response);
$this->featureContext->pushToLastHttpStatusCodesArray();
@@ -577,7 +577,7 @@ class NotificationContext implements Context {
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat(
$deprovision_date,
$deprovision_date_format
) {
): void {
$response = $this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format);
$this->featureContext->setResponse($response);
$this->featureContext->pushToLastHttpStatusCodesArray();

View File

@@ -111,7 +111,7 @@ trait Provisioning {
* @return mixed
* @throws Exception
*/
public function getAttributeOfCreatedUser(string $user, string $attribute) {
public function getAttributeOfCreatedUser(string $user, string $attribute): mixed {
$usersList = $this->getCreatedUsers();
$normalizedUsername = $this->normalizeUsername($user);
if (\array_key_exists($normalizedUsername, $usersList)) {
@@ -132,7 +132,7 @@ trait Provisioning {
* @return mixed
* @throws Exception
*/
public function getAttributeOfCreatedGroup(string $group, string $attribute) {
public function getAttributeOfCreatedGroup(string $group, string $attribute): mixed {
$groupsList = $this->getCreatedGroups();
if (\array_key_exists($group, $groupsList)) {
if (\array_key_exists($attribute, $groupsList[$group])) {
@@ -542,7 +542,7 @@ trait Provisioning {
TableNode $table,
bool $useDefault = true,
bool $initialize = true
) {
): void {
$this->verifyTableNodeColumns($table, ['username'], ['displayname', 'email', 'password']);
$table = $table->getColumnsHash();
$users = $this->buildUsersAttributesArray($useDefault, $table);

View File

@@ -457,7 +457,7 @@ trait Sharing {
* @return void
* @throws Exception
*/
public function userHasCreatedAShareWithSettings(string $user, ?TableNode $body) {
public function userHasCreatedAShareWithSettings(string $user, ?TableNode $body): void {
$response = $this->createShareWithSettings(
$user,
$body
@@ -1379,7 +1379,7 @@ trait Sharing {
string $filepath,
string $user2,
$permissions = null
) {
): void {
$response = $this->createAUserShare(
$this->getCurrentUser(),
$filepath["path"],
@@ -1508,7 +1508,7 @@ trait Sharing {
string $filepath,
string $group,
$permissions = null
) {
): void {
$response = $this->createAGroupShare(
$user,
$filepath,
@@ -1536,7 +1536,7 @@ trait Sharing {
string $group,
TableNode $table,
$permissions = null
) {
): void {
$this->verifyTableNodeColumns($table, ["path"]);
$paths = $table->getHash();
@@ -1568,7 +1568,7 @@ trait Sharing {
string $filepath,
string $group,
$permissions = null
) {
): void {
$response = $this->createAGroupShare(
$user,
$filepath,
@@ -1863,7 +1863,7 @@ trait Sharing {
string $sharer,
string $sharee,
TableNode $table
) {
): void {
$response = $this->getLastShareInfo($requester, "user");
$this->theHTTPStatusCodeShouldBe(200, "", $response);
$this->ocsContext->theOCSStatusCodeShouldBe("100,200", "", $response);
@@ -2577,7 +2577,7 @@ trait Sharing {
// change string "true"/"false" to boolean inside array
\array_walk_recursive(
$attributes,
function (&$value, $key) {
function (&$value, $key): void {
if ($key !== 'enabled') {
return;
}
@@ -3100,7 +3100,7 @@ trait Sharing {
* @return void
* @throws Exception
*/
public function userHasAcceptedThePendingShareOfferedBy(string $user, string $share, string $offeredBy) {
public function userHasAcceptedThePendingShareOfferedBy(string $user, string $share, string $offeredBy): void {
$response = $this->reactToShareOfferedBy($user, 'accepts', $share, $offeredBy, 'pending');
$this->theHTTPStatusCodeShouldBe(
200,
@@ -3126,7 +3126,7 @@ trait Sharing {
string $action,
string $share,
string $offeredBy
) {
): void {
if ($action === 'accept') {
$response = $this->reactToShareOfferedBy($user, 'accepts', $share, $offeredBy, 'pending');
$this->theHTTPStatusCodeShouldBe(

View File

@@ -710,7 +710,7 @@ class SharingNgContext implements Context {
*
* @return void
*/
public function userUpdatesTheLastShareWithFollowingPropertiesUsingGraphApi($user, TableNode $table) {
public function userUpdatesTheLastShareWithFollowingPropertiesUsingGraphApi($user, TableNode $table): void {
$permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
$this->featureContext->setResponse(
$this->updateResourceShare(
@@ -736,7 +736,7 @@ class SharingNgContext implements Context {
string $shareType,
string $sharee,
TableNode $table
) {
): void {
$permissionID = "";
if ($shareType === "user") {
$permissionID = "u:" . $this->featureContext->getAttributeOfCreatedUser($sharee, 'id');

View File

@@ -2572,7 +2572,7 @@ class SpacesContext implements Context {
string $shareType,
string $spaceName,
string $memberUser
) {
): void {
$dateTime = new DateTime('yesterday');
$rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP');
$rows['shareWith'] = $memberUser;
@@ -4608,7 +4608,7 @@ class SpacesContext implements Context {
* @throws GuzzleException
* @throws Exception
*/
public function publicDownloadsTheFolderFromTheLastCreatedPublicLink(string $resource) {
public function publicDownloadsTheFolderFromTheLastCreatedPublicLink(string $resource): void {
$token = ($this->featureContext->isUsingSharingNG())
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();

View File

@@ -441,7 +441,7 @@ class TrashbinContext implements Context {
* @return void
* @throws Exception
*/
public function userTriesToListTheTrashbinContentForUser(string $asUser, string $user) {
public function userTriesToListTheTrashbinContentForUser(string $asUser, string $user): void {
$user = $this->featureContext->getActualUsername($user);
$asUser = $this->featureContext->getActualUsername($asUser);
$response = $this->sendTrashbinListRequest($user, $asUser);

View File

@@ -508,7 +508,7 @@ trait WebDav {
*
* @return ResponseInterface
*/
public function moveResource(string $user, string $source, string $destination) {
public function moveResource(string $user, string $source, string $destination): ResponseInterface {
$user = $this->getActualUsername($user);
$headers['Destination'] = $this->destinationHeaderValue(
$user,
@@ -3617,7 +3617,7 @@ trait WebDav {
string $path,
string $width,
string $height
) {
): void {
$user = $this->getActualUsername($user);
$urlParameter = [
'x' => $width,
@@ -4575,7 +4575,7 @@ trait WebDav {
string $type = "files",
string $folderPath = '',
?string $spaceId = null
) {
): string|array|bool {
$trimmedEntryNameToSearch = '';
// trim any leading "/" passed by the caller, we can just match the "raw" name
if ($entryNameToSearch != null) {
@@ -4634,7 +4634,7 @@ trait WebDav {
?string $entryNameToSearch = null,
?bool $searchForHighlightString = false,
?string $spaceId = null
) {
): string|array|bool {
// trim any leading "/" passed by the caller, we can just match the "raw" name
if ($entryNameToSearch !== null) {
$entryNameToSearch = \trim($entryNameToSearch, "/");

View File

@@ -141,7 +141,11 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function userLocksFileSettingPropertiesUsingWebDavAPI(string $user, string $file, TableNode $properties) {
public function userLocksFileSettingPropertiesUsingWebDavAPI(
string $user,
string $file,
TableNode $properties
): void {
$spaceId = null;
if (\str_starts_with($file, "Shares/")
&& $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES
@@ -166,7 +170,7 @@ class WebDavLockingContext implements Context {
string $user,
string $file,
TableNode $properties
) {
): void {
$response = $this->lockFile($user, $file, $properties, null, false, false);
$this->featureContext->setResponse($response);
}
@@ -187,7 +191,7 @@ class WebDavLockingContext implements Context {
string $file,
string $space,
TableNode $properties
) {
): void {
$this->featureContext->setResponse($this->userLocksFileInProjectSpace($user, $file, $space, $properties));
}
@@ -256,7 +260,7 @@ class WebDavLockingContext implements Context {
string $file,
string $space,
TableNode $properties
) {
): void {
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
$davPathVersion = $this->featureContext->getDavPathVersion();
$suffixPath = $user;
@@ -285,7 +289,7 @@ class WebDavLockingContext implements Context {
string $file,
string $fileId,
TableNode $properties
) {
): void {
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
$davPath = \rtrim($davPath, '/');
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId";
@@ -308,7 +312,7 @@ class WebDavLockingContext implements Context {
string $file,
string $fileId,
TableNode $properties
) {
): void {
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
$davPath = \rtrim($davPath, '/');
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId";
@@ -325,7 +329,7 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function userHasLockedFile(string $user, string $file, TableNode $properties) {
public function userHasLockedFile(string $user, string $file, TableNode $properties): void {
$response = $this->lockFile($user, $file, $properties);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
}
@@ -345,7 +349,7 @@ class WebDavLockingContext implements Context {
string $file,
string $spaceName,
TableNode $properties
) {
): void {
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
$response = $this->lockFile($user, $file, $properties, null, false, true, $spaceId);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
@@ -361,7 +365,12 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function userHasLockedFileUsingFileId(string $user, string $file, string $fileId, TableNode $properties) {
public function userHasLockedFileUsingFileId(
string $user,
string $file,
string $fileId,
TableNode $properties
): void {
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
$davPath = \rtrim($davPath, '/');
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId";
@@ -376,7 +385,7 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function publicHasLockedLastSharedFile(TableNode $properties) {
public function publicHasLockedLastSharedFile(TableNode $properties): void {
$response = $this->lockFile(
$this->featureContext->getLastCreatedPublicShareToken(),
"/",
@@ -395,7 +404,7 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function publicLocksLastSharedFile(TableNode $properties) {
public function publicLocksLastSharedFile(TableNode $properties): void {
$token = ($this->featureContext->isUsingSharingNG())
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
@@ -421,7 +430,7 @@ class WebDavLockingContext implements Context {
public function publicHasLockedFileLastSharedFolder(
string $file,
TableNode $properties
) {
): void {
$token = ($this->featureContext->isUsingSharingNG())
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
@@ -447,7 +456,7 @@ class WebDavLockingContext implements Context {
public function publicLocksFileLastSharedFolder(
string $file,
TableNode $properties
) {
): void {
$token = ($this->featureContext->isUsingSharingNG())
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
@@ -470,7 +479,7 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function unlockLastLockUsingWebDavAPI(string $user, string $file) {
public function unlockLastLockUsingWebDavAPI(string $user, string $file): void {
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
$user,
$file,
@@ -493,7 +502,7 @@ class WebDavLockingContext implements Context {
string $user,
string $spaceName,
string $file
) {
): void {
$spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName);
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
$user,
@@ -520,7 +529,7 @@ class WebDavLockingContext implements Context {
string $user,
string $itemToUnlock,
string $fileId
) {
): void {
$davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion());
$davPath = \rtrim($davPath, '/');
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId";
@@ -548,7 +557,7 @@ class WebDavLockingContext implements Context {
string $user,
string $itemToUnlock,
string $itemToUseLockOf
) {
): void {
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
$user,
$itemToUnlock,
@@ -571,7 +580,7 @@ class WebDavLockingContext implements Context {
string $user,
string $itemToUnlock,
string $itemToUseLockOf
) {
): void {
$lockOwner = $this->featureContext->getLastCreatedPublicShareToken();
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
$user,
@@ -640,7 +649,7 @@ class WebDavLockingContext implements Context {
string $lockOwner,
string $itemToUseLockOf,
bool $public = false
) {
): void {
$lockCount = $this->countLockOfResources($user, $itemToUnlock);
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
@@ -742,7 +751,7 @@ class WebDavLockingContext implements Context {
string $itemToUnlock,
string $lockOwner,
string $itemToUseLockOf
) {
): void {
$response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI(
$user,
$itemToUnlock,
@@ -765,7 +774,7 @@ class WebDavLockingContext implements Context {
string $itemToUnlock,
string $lockOwner,
string $itemToUseLockOf
) {
): void {
$token = ($this->featureContext->isUsingSharingNG())
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
@@ -786,7 +795,7 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function unlockItemAsPublicUsingWebDavAPI(string $itemToUnlock) {
public function unlockItemAsPublicUsingWebDavAPI(string $itemToUnlock): void {
$token = ($this->featureContext->isUsingSharingNG())
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
@@ -815,7 +824,7 @@ class WebDavLockingContext implements Context {
string $fileSource,
string $fileDestination,
string $itemToUseLockOf
) {
): void {
$response = $this->moveItemSendingLockTokenOfUser(
$user,
$fileSource,
@@ -878,7 +887,7 @@ class WebDavLockingContext implements Context {
string $fileDestination,
string $itemToUseLockOf,
string $lockOwner
) {
): void {
$response = $this->moveItemSendingLockTokenOfUser(
$user,
$fileSource,
@@ -904,7 +913,7 @@ class WebDavLockingContext implements Context {
string $content,
string $destination,
string $itemToUseLockOf
) {
): void {
$user = $this->featureContext->getActualUsername($user);
$token = $this->tokenOfLastLock[$user][$itemToUseLockOf];
$this->featureContext->pauseUploadDelete();
@@ -929,7 +938,7 @@ class WebDavLockingContext implements Context {
* @return void
* @throws GuzzleException
*/
public function numberOfLockShouldBeReported(int $count, string $file, string $user) {
public function numberOfLockShouldBeReported(int $count, string $file, string $user): void {
$lockCount = $this->countLockOfResources($user, $file);
Assert::assertEquals(
$count,
@@ -965,7 +974,7 @@ class WebDavLockingContext implements Context {
string $file,
string $spaceName,
string $user
) {
): void {
$response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file, null, '0');
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
$responseXmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__);
@@ -992,7 +1001,7 @@ class WebDavLockingContext implements Context {
*
* @return void
*/
public function before(BeforeScenarioScope $scope) {
public function before(BeforeScenarioScope $scope): void {
// Get the environment
$environment = $scope->getEnvironment();
// Get all the contexts you need in this context

View File

@@ -148,7 +148,7 @@ class WebDavPropertiesContext implements Context {
* @return void
* @throws Exception
*/
public function theUserGetsPropertiesOfFolder(string $path, TableNode $propertiesTable) {
public function theUserGetsPropertiesOfFolder(string $path, TableNode $propertiesTable): void {
$response = $this->getPropertiesOfFolder(
$this->featureContext->getCurrentUser(),
$path,
@@ -174,7 +174,7 @@ class WebDavPropertiesContext implements Context {
string $username,
string $path,
TableNode $propertiesTable
) {
): void {
$username = $this->featureContext->getActualUsername($username);
$this->featureContext->verifyTableNodeColumns($propertiesTable, ['propertyName', 'propertyValue']);
$properties = $propertiesTable->getColumnsHash();