Skip to content

Commit 2ac8058

Browse files
committed
chore: Run rector
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 0cffaa2 commit 2ac8058

9 files changed

Lines changed: 31 additions & 29 deletions

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"psalm": "psalm",
1919
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType",
2020
"psalm:update-baseline": "psalm --threads=1 --update-baseline",
21-
"test:integration": "cd tests/integration && ./run.sh"
21+
"test:integration": "cd tests/integration && ./run.sh",
22+
"rector": "rector && composer cs:fix"
2223
},
2324
"license": "AGPLv3",
2425
"authors": [

lib/Command/GroupAdminsToLdap.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class GroupAdminsToLdap extends Command {
3131
* GroupAdminsToLdap constructor.
3232
*/
3333
public function __construct(
34-
private SubAdmin $subAdmin,
35-
private IConfig $ocConfig,
36-
private Helper $helper,
37-
private Group_Proxy $groupProxy,
34+
private readonly SubAdmin $subAdmin,
35+
private readonly IConfig $ocConfig,
36+
private readonly Helper $helper,
37+
private readonly Group_Proxy $groupProxy,
3838
) {
3939
parent::__construct();
4040
}
@@ -136,7 +136,7 @@ function diff_user_arrays($array1, $array2) {
136136
foreach ($onlyInNC as $gid => $users) {
137137
$groupDN = $access->getGroupMapper()->getDNByName($gid);
138138
if ($groupDN === false) {
139-
throw new Exception('Failed to find group '.$gid);
139+
throw new Exception('Failed to find group ' . $gid);
140140
}
141141
foreach ($users as $uid) {
142142
$userDN = $access->getUserMapper()->getDNByName($uid);
@@ -155,7 +155,7 @@ function diff_user_arrays($array1, $array2) {
155155
foreach ($onlyInLDAP as $gid => $users) {
156156
$groupDN = $access->getGroupMapper()->getDNByName($gid);
157157
if ($groupDN === false) {
158-
throw new Exception('Failed to find group '.$gid);
158+
throw new Exception('Failed to find group ' . $gid);
159159
}
160160
foreach ($users as $uid) {
161161
$userDN = $access->getUserMapper()->getDNByName($uid);

lib/LDAPConnect.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@
1111
namespace OCA\LdapWriteSupport;
1212

1313
use LDAP\Connection;
14+
use LDAP\Result;
1415
use OC\ServerNotAvailableException;
1516
use OCA\LdapWriteSupport\AppInfo\Application;
1617
use OCA\User_LDAP\Configuration;
1718
use OCA\User_LDAP\Helper;
1819
use Psr\Log\LoggerInterface;
1920

2021
class LDAPConnect {
21-
private Configuration $ldapConfig;
22+
private readonly Configuration $ldapConfig;
2223
private ?bool $passwdSupport;
2324

2425
public function __construct(
2526
Helper $ldapBackendHelper,
26-
private LoggerInterface $logger,
27+
private readonly LoggerInterface $logger,
2728
) {
2829
$this->passwdSupport = null;
2930
$ldapConfigPrefixes = $ldapBackendHelper->getServerConfigurationPrefixes(true);
@@ -144,7 +145,7 @@ public function hasPasswordPolicy(): bool {
144145
public function hasPasswdExopSupport(Connection $connection): bool {
145146
// TODO: We should cache this by ldap prefix, but currently we have no access to it.
146147
if (is_null($this->passwdSupport)) {
147-
/** @var \LDAP\Result|false */
148+
/** @var Result|false */
148149
$ret = ldap_read($connection, '', '(objectclass=*)', ['supportedExtension']);
149150
if ($ret === false) {
150151
$this->passwdSupport = false;

lib/LDAPGroupManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
class LDAPGroupManager implements ILDAPGroupPlugin {
2222
public function __construct(
23-
private IGroupManager $groupManager,
24-
private LDAPConnect $ldapConnect,
25-
private LoggerInterface $logger,
26-
private ILDAPProvider $ldapProvider,
23+
private readonly IGroupManager $groupManager,
24+
private readonly LDAPConnect $ldapConnect,
25+
private readonly LoggerInterface $logger,
26+
private readonly ILDAPProvider $ldapProvider,
2727
) {
2828
if ($this->ldapConnect->groupsEnabled()) {
2929
$this->makeLdapBackendFirst();

lib/LDAPUserManager.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131

3232
class LDAPUserManager implements ILDAPUserPlugin {
3333
public function __construct(
34-
private IUserManager $userManager,
35-
private IUserSession $userSession,
36-
private LDAPConnect $ldapConnect,
37-
private ILDAPProvider $ldapProvider,
38-
private Configuration $configuration,
39-
private IL10N $l10n,
40-
private LoggerInterface $logger,
34+
private readonly IUserManager $userManager,
35+
private readonly IUserSession $userSession,
36+
private readonly LDAPConnect $ldapConnect,
37+
private readonly ILDAPProvider $ldapProvider,
38+
private readonly Configuration $configuration,
39+
private readonly IL10N $l10n,
40+
private readonly LoggerInterface $logger,
4141
) {
42-
$this->userManager->listen('\OC\User', 'changeUser', [$this, 'changeUserHook']);
42+
$this->userManager->listen('\OC\User', 'changeUser', $this->changeUserHook(...));
4343
$this->makeLdapBackendFirst();
4444
}
4545

lib/Listener/GroupBackendRegisteredListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*/
2121
class GroupBackendRegisteredListener implements IEventListener {
2222
public function __construct(
23-
private IAppManager $appManager,
24-
private LDAPGroupManager $ldapGroupManager,
23+
private readonly IAppManager $appManager,
24+
private readonly LDAPGroupManager $ldapGroupManager,
2525
) {
2626
}
2727

lib/Listener/UserBackendRegisteredListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*/
2121
class UserBackendRegisteredListener implements IEventListener {
2222
public function __construct(
23-
private IAppManager $appManager,
24-
private LDAPUserManager $ldapUserManager,
23+
private readonly IAppManager $appManager,
24+
private readonly LDAPUserManager $ldapUserManager,
2525
) {
2626
}
2727

lib/Service/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Configuration {
1616
public function __construct(
17-
private IConfig $config,
17+
private readonly IConfig $config,
1818
) {
1919
}
2020

lib/Settings/Admin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
class Admin implements ISettings {
2020
public function __construct(
21-
private IInitialState $initialStateService,
22-
private Configuration $config,
21+
private readonly IInitialState $initialStateService,
22+
private readonly Configuration $config,
2323
) {
2424
}
2525

0 commit comments

Comments
 (0)