@@ -59,10 +59,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
5959 ->setLegacyAuthMechanism ($ legacyAuth );
6060 }
6161
62- /**
63- * @return void
64- */
65- public function manipulateStorageConfig (StorageConfig &$ storage , ?IUser $ user = null ) {
62+ public function manipulateStorageConfig (StorageConfig &$ storage , ?IUser $ user = null ): void {
6663 $ auth = $ storage ->getAuthMechanism ();
6764 if ($ auth ->getScheme () === AuthMechanism::SCHEME_PASSWORD ) {
6865 if (!is_string ($ storage ->getBackendOption ('user ' )) || !is_string ($ storage ->getBackendOption ('password ' ))) {
@@ -92,26 +89,25 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user =
9289 } else {
9390 try {
9491 $ credentials = $ credentialsStore ->getLoginCredentials ();
95- $ user = $ credentials ->getLoginName ();
92+ $ loginName = $ credentials ->getLoginName ();
9693 $ pass = $ credentials ->getPassword ();
97- preg_match ('/(.*)@(.*)/ ' , $ user , $ matches );
94+ preg_match ('/(.*)@(.*)/ ' , $ loginName , $ matches );
9895 $ realm = $ storage ->getBackendOption ('default_realm ' );
9996 if (empty ($ realm )) {
10097 $ realm = 'WORKGROUP ' ;
10198 }
10299 if (count ($ matches ) === 0 ) {
103- $ username = $ user ;
100+ $ username = $ loginName ;
104101 $ workgroup = $ realm ;
105102 } else {
106- $ username = $ matches [1 ];
107- $ workgroup = $ matches [2 ];
103+ [, $ username , $ workgroup ] = $ matches ;
108104 }
109105 $ smbAuth = new BasicAuth (
110106 $ username ,
111107 $ workgroup ,
112108 $ pass
113109 );
114- } catch (\Exception $ e ) {
110+ } catch (\Exception ) {
115111 throw new InsufficientDataForMeaningfulAnswerException ('No session credentials saved ' );
116112 }
117113 }
@@ -125,7 +121,7 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user =
125121 $ storage ->setBackendOption ('auth ' , $ smbAuth );
126122 }
127123
128- public function checkDependencies () {
124+ public function checkDependencies (): array {
129125 $ system = \OCP \Server::get (SystemBridge::class);
130126 if (NativeServer::available ($ system )) {
131127 return [];
0 commit comments