diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php
index 56eece341a94695921286d5507d5f503811ae1ac..7a5f5650fc5966aaef438d138ba50a189cb0c552 100644
--- a/apps/files_sharing/appinfo/routes.php
+++ b/apps/files_sharing/appinfo/routes.php
@@ -26,8 +26,6 @@
  *
  */
 
-use OCP\API;
-
 $application = new \OCA\Files_Sharing\AppInfo\Application();
 $application->registerRoutes($this, [
 	'resources' => [
@@ -127,7 +125,3 @@ $application->registerRoutes($this, [
 /** @var $this \OCP\Route\IRouter */
 $this->create('sharing_external_shareinfo', '/shareinfo')
 	->actionInclude('files_sharing/ajax/shareinfo.php');
-
-// OCS API
-
-//TODO: SET: mail notification, waiting for PR #4689 to be accepted
diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
index cf4954800e862db0aaa8c56e332cf9c60a4eaba1..f89fb0b0052012d4f3bc9eca2f069b54a57e6b5b 100644
--- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
+++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
@@ -23,9 +23,7 @@ namespace OCA\Files_Sharing\Activity\Providers;
 
 use OCP\Activity\IEvent;
 use OCP\Activity\IManager;
-use OCP\Activity\IProvider;
 use OCP\Federation\ICloudIdManager;
-use OCP\IL10N;
 use OCP\IURLGenerator;
 use OCP\IUserManager;
 use OCP\L10N\IFactory;
diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php
index 22a8a8a0a3d2881e2e3b4d4ee795d9856c26ed5f..e8e6a4c26f32e7879dec8d94d124fabec37d848e 100644
--- a/apps/files_sharing/lib/Capabilities.php
+++ b/apps/files_sharing/lib/Capabilities.php
@@ -71,7 +71,7 @@ class Capabilities implements ICapability {
 				$public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes';
 				$public['upload_files_drop'] = $public['upload'];
 			}
-			$res["public"] = $public;
+			$res['public'] = $public;
 
 			$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
 
diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
index 504caba141759227c10b96db17cb3a49587bebd0..389b0dc49856e7eece27c6f45ce8b256e4916f90 100644
--- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
+++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
@@ -60,11 +60,11 @@ class CleanupRemoteStorages extends Command {
 
 		$remoteStorages = $this->getRemoteStorages();
 
-		$output->writeln(count($remoteStorages) . " remote storage(s) need(s) to be checked");
+		$output->writeln(count($remoteStorages) . ' remote storage(s) need(s) to be checked');
 
 		$remoteShareIds = $this->getRemoteShareIds();
 
-		$output->writeln(count($remoteShareIds) . " remote share(s) exist");
+		$output->writeln(count($remoteShareIds) . ' remote share(s) exist');
 
 		foreach ($remoteShareIds as $id => $remoteShareId) {
 			if (isset($remoteStorages[$remoteShareId])) {
@@ -79,7 +79,7 @@ class CleanupRemoteStorages extends Command {
 		}
 
 		if (empty($remoteStorages)) {
-			$output->writeln("<info>no storages deleted</info>");
+			$output->writeln('<info>no storages deleted</info>');
 		} else {
 			$dryRun = $input->getOption('dry-run');
 			foreach ($remoteStorages as $id => $numericId) {
diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php
index 19c0606dc463d84bb776abd49df09338ce4c5f14..212b7fa008e1deec09f02bfd1f140db725cb744e 100644
--- a/apps/files_sharing/lib/ExpireSharesJob.php
+++ b/apps/files_sharing/lib/ExpireSharesJob.php
@@ -44,7 +44,6 @@ class ExpireSharesJob extends TimedJob {
 	 */
 	public function run($argument) {
 		$connection = \OC::$server->getDatabaseConnection();
-		$logger = \OC::$server->getLogger();
 
 		//Current time
 		$now = new \DateTime();
diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
index 5712b96b97dcbe408757820cbc924bdbac4e062c..9dd8d2e5ae985ed2fcaae5c22f4dcb618e120218 100644
--- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
@@ -37,6 +37,7 @@ use OCA\Files_Sharing\Exceptions\S2SException;
 use OCP\AppFramework\Http\JSONResponse;
 use OCP\IRequest;
 use OCP\Share\IManager;
+use OCP\Share\Exceptions\ShareNotFound;
 
 /**
  * Checks whether the "sharing check" is enabled
@@ -88,6 +89,7 @@ class SharingCheckMiddleware extends Middleware {
 	 * @param string $methodName
 	 * @throws NotFoundException
 	 * @throws S2SException
+	 * @throws ShareNotFound
 	 */
 	public function beforeController($controller, $methodName) {
 		if(!$this->isSharingEnabled()) {
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php
index 4929bebf40bbb31d93617ae306c347e799534547..07e353cc6a68400b2616ac0bae8d6b8f62e68755 100644
--- a/apps/files_sharing/lib/ShareBackend/Folder.php
+++ b/apps/files_sharing/lib/ShareBackend/Folder.php
@@ -50,8 +50,8 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
 					$share['file_path'] = $name;
 					$displayNameOwner = \OCP\User::getDisplayName($share['uid_owner']);
 					$displayNameShareWith = \OCP\User::getDisplayName($share['share_with']);
-					$share['displayname_owner'] = ($displayNameOwner) ? $displayNameOwner : $share['uid_owner'];
-					$share['share_with_displayname'] = ($displayNameShareWith) ? $displayNameShareWith : $share['uid_owner'];
+					$share['displayname_owner'] = $displayNameOwner ? $displayNameOwner : $share['uid_owner'];
+					$share['share_with_displayname'] = $displayNameShareWith ? $displayNameShareWith : $share['uid_owner'];
 
 					$result[] = $share;
 				}
@@ -72,7 +72,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
 		$query = \OCP\DB::prepare('SELECT `parent` FROM `*PREFIX*filecache` WHERE `fileid` = ?');
 		$result = $query->execute(array($child));
 		$row = $result->fetchRow();
-		$parent = ($row) ? $row['parent'] : null;
+		$parent = $row ? $row['parent'] : null;
 
 		return $parent;
 	}
diff --git a/apps/files_sharing/tests/BackendTest.php b/apps/files_sharing/tests/BackendTest.php
index cea8762a5b4215ed942f2fd90e29622ea4723c38..b9c7f0e813d94fff63c998b6ef965cb1c20167a3 100644
--- a/apps/files_sharing/tests/BackendTest.php
+++ b/apps/files_sharing/tests/BackendTest.php
@@ -68,7 +68,7 @@ class BackendTest extends TestCase {
 		parent::tearDown();
 	}
 
-	function testGetParents() {
+	public function testGetParents() {
 
 		$fileinfo1 = $this->view->getFileInfo($this->folder);
 		$fileinfo2 = $this->view->getFileInfo($this->folder . $this->subfolder . $this->subsubfolder);
diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php
index 663adc1f2717962c421356ef4e45b8846552532a..1747bbc4ed204aeb5563693daeff9524e276d243 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -24,8 +24,7 @@
 namespace OCA\Files_Sharing\Tests;
 
 use OCA\Files_Sharing\Capabilities;
-use OCA\Files_Sharing\Tests\TestCase;
-use OCP\App\IAppManager;
+
 
 /**
  * Class CapabilitiesTest
diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
index 5dcf7f8310548de8a9f5502a4ef79ef5ae7193c3..827fcc15797baf7d28c1b264c759fff9983e64be 100644
--- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
+++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php
@@ -22,7 +22,6 @@
 namespace OCA\Files_Sharing\Tests\Command;
 
 use OCA\Files_Sharing\Command\CleanupRemoteStorages;
-use OCP\DB\QueryBuilder\IQueryBuilder;
 use Test\TestCase;
 
 /**
diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php
index d5fe83f44e27eccdd66db44025e23e198f4d8730..e1e73ee82c2ea30c26680f0d8ac69c34aa21afc1 100644
--- a/apps/files_sharing/tests/HelperTest.php
+++ b/apps/files_sharing/tests/HelperTest.php
@@ -35,7 +35,7 @@ class HelperTest extends TestCase {
 	/**
 	 * test set and get share folder
 	 */
-	function testSetGetShareFolder() {
+	public function testSetGetShareFolder() {
 		$this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
 
 		\OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder');
diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php
index b700d417ad4f85bd05d7d18bbf0cb16087b94ed9..04476987a327780e7132159c5716a7bd8aac3024 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -33,7 +33,6 @@ use OCP\IUser;
 use OCP\IUserManager;
 use OCP\Share\IShare;
 use OCP\Share\IManager;
-use OCP\Files\Mount\IMountPoint;
 
 /**
  * @group DB
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php
index 72cc891e36819a722d1fb8e80946072d52dcb97c..6f21bd3b92dafd71f613cd8cdcef292b5f88808c 100644
--- a/apps/files_sharing/tests/SharedMountTest.php
+++ b/apps/files_sharing/tests/SharedMountTest.php
@@ -54,8 +54,8 @@ class SharedMountTest extends TestCase {
 		$this->view->mkdir($this->folder);
 
 		// save file with content
-		$this->view->file_put_contents($this->filename, "root file");
-		$this->view->file_put_contents($this->folder . $this->filename, "file in subfolder");
+		$this->view->file_put_contents($this->filename, 'root file');
+		$this->view->file_put_contents($this->folder . $this->filename, 'file in subfolder');
 
 		$this->groupManager = \OC::$server->getGroupManager();
 		$this->userManager = \OC::$server->getUserManager();
@@ -204,18 +204,18 @@ class SharedMountTest extends TestCase {
 
 		$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
 
-		\OC\Files\Filesystem::rename($this->filename, "newFileName");
+		\OC\Files\Filesystem::rename($this->filename, 'newFileName');
 
 		$this->assertTrue(\OC\Files\Filesystem::file_exists('newFileName'));
 		$this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
 
 		self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
 		$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
-		$this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName"));
+		$this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName'));
 
 		self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
 		$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
-		$this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName"));
+		$this->assertFalse(\OC\Files\Filesystem::file_exists('newFileName'));
 
 		//cleanup
 		self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -240,7 +240,7 @@ class SharedMountTest extends TestCase {
 			if ($exception) {
 				$this->assertSame(10, $e->getCode());
 			} else {
-				$this->assertTrue(false, "Exception catched, but expected: " . $expectedResult);
+				$this->assertTrue(false, 'Exception catched, but expected: ' . $expectedResult);
 			}
 		}
 	}
@@ -323,7 +323,7 @@ class SharedMountTest extends TestCase {
 	 *
 	 * @dataProvider dataPermissionMovedGroupShare
 	 */
-	function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) {
+	public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) {
 
 		if ($type === 'file') {
 			$path = $this->filename;
@@ -355,7 +355,7 @@ class SharedMountTest extends TestCase {
 		$this->assertEquals($beforePerm, $result->getPermissions());
 
 		// Now move the item forcing a new entry in the share table
-		\OC\Files\Filesystem::rename($path, "newPath");
+		\OC\Files\Filesystem::rename($path, 'newPath');
 		$this->assertTrue(\OC\Files\Filesystem::file_exists('newPath'));
 		$this->assertFalse(\OC\Files\Filesystem::file_exists($path));
 
@@ -388,7 +388,7 @@ class SharedMountTest extends TestCase {
 	 * If the permissions on a group share are upgraded be sure to still respect 
 	 * removed shares by a member of that group
 	 */
-	function testPermissionUpgradeOnUserDeletedGroupShare() {
+	public function testPermissionUpgradeOnUserDeletedGroupShare() {
 		$testGroup = $this->groupManager->createGroup('testGroup');
 		$user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1);
 		$user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php
index 9d80633b46a6a917ccc418fb397a66764495b5b8..f7ad9057959a3763ea22114e4106e5708b87cbe1 100644
--- a/apps/files_sharing/tests/SizePropagationTest.php
+++ b/apps/files_sharing/tests/SizePropagationTest.php
@@ -26,7 +26,6 @@
 namespace OCA\Files_Sharing\Tests;
 
 use OC\Files\View;
-use Test\Traits\MountProviderTrait;
 use Test\Traits\UserTrait;
 
 /**
diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php
index 2bde37af20ed3fb3f66886cf2b012417a0a5b7c7..ce7767d192053715d5f9435e09f674fb57600ed7 100644
--- a/apps/files_sharing/tests/UnshareChildrenTest.php
+++ b/apps/files_sharing/tests/UnshareChildrenTest.php
@@ -74,7 +74,7 @@ class UnshareChildrenTest extends TestCase {
 	/**
 	 * @medium
 	 */
-	function testUnshareChildren() {
+	public function testUnshareChildren() {
 
 		$fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
 
diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index bb320336d4898df726ad55151a860c0af9abd966..c35bcf1a08c31b7a37a146ed2f75349d0ae6d6eb 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -69,7 +69,7 @@ class UpdaterTest extends TestCase {
 	 * points should be unshared before the folder gets deleted so
 	 * that the mount point doesn't end up at the trash bin
 	 */
-	function testDeleteParentFolder() {
+	public function testDeleteParentFolder() {
 		$status = \OC_App::isEnabled('files_trashbin');
 		(new \OC_App())->enable('files_trashbin');
 
@@ -96,8 +96,8 @@ class UpdaterTest extends TestCase {
 		$foldersShared = \OCP\Share::getItemsSharedWith('folder');
 		$this->assertSame(1, count($foldersShared));
 
-		$view->mkdir("localFolder");
-		$view->file_put_contents("localFolder/localFile.txt", "local file");
+		$view->mkdir('localFolder');
+		$view->file_put_contents('localFolder/localFile.txt', 'local file');
 
 		$view->rename($this->folder, 'localFolder/' . $this->folder);
 
@@ -196,7 +196,7 @@ class UpdaterTest extends TestCase {
 	/**
 	 * if a folder gets renamed all children mount points should be renamed too
 	 */
-	function testRename() {
+	public function testRename() {
 
 		$fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
 
diff --git a/apps/provisioning_api/lib/Controller/AppsController.php b/apps/provisioning_api/lib/Controller/AppsController.php
index 7031687576243fe31de847cd0adda11772534d9c..d65b925cf7b8af585e29e98b42c3863dad3decf7 100644
--- a/apps/provisioning_api/lib/Controller/AppsController.php
+++ b/apps/provisioning_api/lib/Controller/AppsController.php
@@ -91,9 +91,9 @@ class AppsController extends OCSController {
 		$info = \OCP\App::getAppInfo($app);
 		if(!is_null($info)) {
 			return new DataResponse(OC_App::getAppInfo($app));
-		} else {
-			throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND);
 		}
+
+		throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND);
 	}
 
 	/**
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 2d329bf974be5c7dc00fbb6006669efe4f6b06fc..e167c07582f85746e7f3b34c8d400673f917a35e 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -30,6 +30,7 @@ use OCP\AppFramework\OCS\OCSException;
 use OCP\AppFramework\OCSController;
 use OCP\IGroup;
 use OCP\IGroupManager;
+use OCP\ILogger;
 use OCP\IRequest;
 use OCP\IUserSession;
 use OCP\IUser;
@@ -43,21 +44,27 @@ class GroupsController extends OCSController {
 	/** @var IUserSession */
 	private $userSession;
 
+	/** @var ILogger */
+	private $logger;
+
 	/**
 	 * @param string $appName
 	 * @param IRequest $request
 	 * @param IGroupManager $groupManager
 	 * @param IUserSession $userSession
+	 * @param ILogger $logger
 	 */
 	public function __construct(
 			$appName,
 			IRequest $request,
 			IGroupManager $groupManager,
-			IUserSession $userSession) {
+			IUserSession $userSession,
+			ILogger $logger) {
 		parent::__construct($appName, $request);
 
 		$this->groupManager = $groupManager;
 		$this->userSession = $userSession;
+		$this->logger = $logger;
 	}
 
 	/**
@@ -120,9 +127,9 @@ class GroupsController extends OCSController {
 			}, $users);
 			$users = array_values($users);
 			return new DataResponse(['users' => $users]);
-		} else {
-			throw new OCSException('User does not have access to specified group', \OCP\API::RESPOND_UNAUTHORISED);
 		}
+
+		throw new OCSException('User does not have access to specified group', \OCP\API::RESPOND_UNAUTHORISED);
 	}
 
 	/**
@@ -136,8 +143,8 @@ class GroupsController extends OCSController {
 	 */
 	public function addGroup($groupid) {
 		// Validate name
-		if(empty($groupid)){
-			\OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR);
+		if(empty($groupid)) {
+			$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
 			throw new OCSException('Invalid group name', 101);
 		}
 		// Check if it exists
@@ -179,6 +186,7 @@ class GroupsController extends OCSController {
 			throw new OCSException('Group does not exist', 101);
 		}
 
+		/** @var IUser[] $subadmins */
 		$subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup);
 		// New class returns IUser[] so convert back
 		$uids = [];
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index 25059e854257b527eb71263c891b1319b17dfe11..caf6ae109f724cdbecc5f4e5efb8fb3b56baac33 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -37,6 +37,7 @@ class GroupsControllerTest extends \Test\TestCase {
 	protected $userSession;
 	/** @var \OC\SubAdmin|\PHPUnit_Framework_MockObject_MockObject */
 	protected $subAdminManager;
+
 	/** @var GroupsController */
 	protected $api;
 
@@ -60,11 +61,15 @@ class GroupsControllerTest extends \Test\TestCase {
 		$request = $this->getMockBuilder('OCP\IRequest')
 			->disableOriginalConstructor()
 			->getMock();
+
+		$logger = $this->createMock(ILogger::class);
+
 		$this->api = new GroupsController(
 			'provisioning_api',
 			$request,
 			$this->groupManager,
-			$this->userSession
+			$this->userSession,
+			$logger
 		);
 	}
 
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index c712cd7485dd4632429a9e02024348d65d968897..19b5fa65e9a3609c1370c66e3c4853b9c455f4e3 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -1128,7 +1128,7 @@ class UsersControllerTest extends TestCase {
 	}
 
 	public function testEditUserAdminUserSelfEditChangeValidQuota() {
-		$loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();;
+		$loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
 		$loggedInUser
 			->expects($this->any())
 			->method('getUID')
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php
index 5658a3824102f27ab1f9b4860aa7169d5f6aa60a..c9cc078ed098ccc482f10ea531edc213f0005f80 100644
--- a/settings/ajax/togglesubadmins.php
+++ b/settings/ajax/togglesubadmins.php
@@ -39,8 +39,8 @@ $targetUserObject = \OC::$server->getUserManager()->get($username);
 $targetGroupObject = \OC::$server->getGroupManager()->get($group);
 
 $isSubAdminOfGroup = false;
-if($targetUserObject !== null && $targetUserObject !== null) {
-	$isSubAdminOfGroup = $subAdminManager->isSubAdminofGroup($targetUserObject, $targetGroupObject);
+if($targetUserObject !== null && $targetGroupObject !== null) {
+	$isSubAdminOfGroup = $subAdminManager->isSubAdminOfGroup($targetUserObject, $targetGroupObject);
 }
 
 // Toggle group
diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php
index 0e68a893ef4c20bd70b01a612efb894ce27a80a6..79109600a39e2c24bdd93accaef4ba0b3a87ed56 100644
--- a/settings/ajax/uninstallapp.php
+++ b/settings/ajax/uninstallapp.php
@@ -47,5 +47,5 @@ if($result !== false) {
 	OC_JSON::success(array('data' => array('appid' => $appId)));
 } else {
 	$l = \OC::$server->getL10N('settings');
-	OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
+	OC_JSON::error(array('data' => array( 'message' => $l->t("Couldn't remove app.") )));
 }
diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php
index bcf8e149140304add3550a1d0bd3db3e102d9d1e..b398e41033bd1ff653cd1adc12fd957ab603db83 100644
--- a/settings/ajax/updateapp.php
+++ b/settings/ajax/updateapp.php
@@ -51,7 +51,7 @@ try {
 	$config->setSystemValue('maintenance', false);
 } catch(Exception $ex) {
 	$config->setSystemValue('maintenance', false);
-	OC_JSON::error(array("data" => array( "message" => $ex->getMessage() )));
+	OC_JSON::error(array('data' => array( 'message' => $ex->getMessage() )));
 	return;
 }
 
@@ -59,5 +59,5 @@ if($result !== false) {
 	OC_JSON::success(array('data' => array('appid' => $appId)));
 } else {
 	$l = \OC::$server->getL10N('settings');
-	OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") )));
+	OC_JSON::error(array('data' => array( 'message' => $l->t("Couldn't update app.") )));
 }