Skip to content

Commit

Permalink
fixup! fixup! Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlSchwan committed May 3, 2022
1 parent b60b654 commit b8a8de4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Group_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ public function removeFromGroup(string $uid, string $gid): bool {
* Gets group details
*
* @param string $gid Name of the group
* @return array
* @return array{displayName?: string}
* @throws Exception
*/
public function getGroupDetails(string $gid): array {
Expand Down
25 changes: 14 additions & 11 deletions apps/user_ldap/lib/Group_Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@
*/
namespace OCA\User_LDAP;

use OCP\Group\Backend\ABackend;
use OCP\Group\Backend\IDeleteGroupBackend;
use OCP\Group\Backend\IGetDisplayNameBackend;
use OCP\Group\Backend\INamedBackend;
use OCP\Group\Backend\IAddToGroupBackend;
use OCP\Group\Backend\ICountUsersBackend;
use OCP\Group\Backend\IGroupDetailsBackend;
use OCP\Group\Backend\IRemoveFromGroupBackend;
use OCP\GroupInterface;

class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGetDisplayNameBackend, INamedBackend, IDeleteGroupBackend {
class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP,
IGetDisplayNameBackend, IDeleteGroupBackend, ICountUsersBackend, IAddToGroupBackend,
IRemoveFromGroupBackend, IGroupDetailsBackend {
private $backends = [];
private $refBackend = null;

Expand Down Expand Up @@ -187,7 +195,7 @@ public function deleteGroup(string $gid): bool {
*
* Adds a user to a group.
*/
public function addToGroup($uid, $gid) {
public function addToGroup(string $uid, string $gid): bool {
return $this->handleRequest(
$gid, 'addToGroup', [$uid, $gid]);
}
Expand All @@ -201,7 +209,7 @@ public function addToGroup($uid, $gid) {
*
* removes the user from a group.
*/
public function removeFromGroup($uid, $gid) {
public function removeFromGroup(string $uid, string $gid): bool {
return $this->handleRequest(
$gid, 'removeFromGroup', [$uid, $gid]);
}
Expand All @@ -211,20 +219,16 @@ public function removeFromGroup($uid, $gid) {
*
* @param string $gid the internal group name
* @param string $search optional, a search string
* @return int|bool
*/
public function countUsersInGroup($gid, $search = '') {
public function countUsersInGroup(string $gid, string $search = ''): int {
return $this->handleRequest(
$gid, 'countUsersInGroup', [$gid, $search]);
}

/**
* get an array with group details
*
* @param string $gid
* @return array|false
* Get an array with group details
*/
public function getGroupDetails($gid) {
public function getGroupDetails(string $gid): array {
return $this->handleRequest(
$gid, 'getGroupDetails', [$gid]);
}
Expand Down Expand Up @@ -276,7 +280,6 @@ public function implementsActions($actions) {
/**
* Return access for LDAP interaction.
*
* @param string $gid
* @return Access instance of Access for LDAP interaction
*/
public function getLDAPAccess($gid) {
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ abstract protected function walkBackends($id, $method, $parameters);
* @param string $id
* @return Access
*/
abstract public function getLDAPAccess($id);
abstract public function getLDAPAccess($gid);

abstract protected function activeBackends(): int;

Expand Down
23 changes: 9 additions & 14 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,14 @@
<code>$lastUpdateCheckTimestamp</code>
</InvalidScalarArgument>
</file>
<file src="apps/user_ldap/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>'OCA\\User_LDAP\\User\\User::postLDAPBackendAdded'</code>
</InvalidArgument>
<TooManyArguments occurrences="1">
<code>dispatch</code>
</TooManyArguments>
</file>
<file src="apps/user_ldap/ajax/getNewServerConfigPrefix.php">
<InvalidScalarArgument occurrences="1">
<code>$ln + 1</code>
Expand All @@ -1904,14 +1912,6 @@
<code>string[]</code>
</InvalidReturnType>
</file>
<file src="apps/user_ldap/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>'OCA\\User_LDAP\\User\\User::postLDAPBackendAdded'</code>
</InvalidArgument>
<TooManyArguments occurrences="1">
<code>dispatch</code>
</TooManyArguments>
</file>
<file src="apps/user_ldap/lib/Connection.php">
<ParadoxicalCondition occurrences="1"/>
</file>
Expand All @@ -1931,11 +1931,6 @@
<code>is_array($list)</code>
</RedundantCondition>
</file>
<file src="apps/user_ldap/lib/Group_Proxy.php">
<ParamNameMismatch occurrences="1">
<code>$gid</code>
</ParamNameMismatch>
</file>
<file src="apps/user_ldap/lib/Jobs/Sync.php">
<InvalidOperand occurrences="2">
<code>$i</code>
Expand Down Expand Up @@ -3671,7 +3666,7 @@
<code>IGroup::class . '::preDelete'</code>
<code>IGroup::class . '::preRemoveUser'</code>
</InvalidArgument>
<RedundantCondition occurrences="2"/>
<RedundantCondition occurrences="1"/>
<TooManyArguments occurrences="6">
<code>dispatch</code>
<code>dispatch</code>
Expand Down
1 change: 0 additions & 1 deletion lib/private/Group/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
use OCP\Group\Backend\ISetDisplayNameBackend;
use OCP\Group\Backend\INamedBackend;
use OCP\IDBConnection;
use OCP\IUser;
use OCP\IUserManager;

/**
Expand Down

0 comments on commit b8a8de4

Please sign in to comment.