From caff1023ea72bb2ea94130e18a2a6e2ccf819e5f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 14:19:56 +0200 Subject: Format control structures, classes, methods and function To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst --- lib/private/Session/CryptoSessionData.php | 6 +++--- lib/private/Session/CryptoWrapper.php | 2 +- lib/private/Session/Internal.php | 4 ++-- lib/private/Session/Memory.php | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/private/Session') diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php index da9bf950ba2..892c2436040 100644 --- a/lib/private/Session/CryptoSessionData.php +++ b/lib/private/Session/CryptoSessionData.php @@ -72,7 +72,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { public function __destruct() { try { $this->close(); - } catch (SessionNotAvailableException $e){ + } catch (SessionNotAvailableException $e) { // This exception can occur if session is already closed // So it is safe to ignore it and let the garbage collector to proceed } @@ -108,7 +108,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * @return string|null Either the value or null */ public function get(string $key) { - if(isset($this->sessionValues[$key])) { + if (isset($this->sessionValues[$key])) { return $this->sessionValues[$key]; } @@ -175,7 +175,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { * Close the session and release the lock, also writes all changed data in batch */ public function close() { - if($this->isModified) { + if ($this->isModified) { $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); $this->session->set(self::encryptedSessionName, $encryptedValue); $this->isModified = false; diff --git a/lib/private/Session/CryptoWrapper.php b/lib/private/Session/CryptoWrapper.php index b9dbc90edd6..bb82652a01d 100644 --- a/lib/private/Session/CryptoWrapper.php +++ b/lib/private/Session/CryptoWrapper.php @@ -83,7 +83,7 @@ class CryptoWrapper { // FIXME: Required for CI if (!defined('PHPUNIT_RUN')) { $webRoot = \OC::$WEBROOT; - if($webRoot === '') { + if ($webRoot === '') { $webRoot = '/'; } diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index 7990c4a7dae..ffe16537874 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -203,12 +203,12 @@ class Internal extends Session { */ private function invoke(string $functionName, array $parameters = [], bool $silence = false) { try { - if($silence) { + if ($silence) { return @call_user_func_array($functionName, $parameters); } else { return call_user_func_array($functionName, $parameters); } - } catch(\Error $e) { + } catch (\Error $e) { $this->trapError($e->getCode(), $e->getMessage()); } } diff --git a/lib/private/Session/Memory.php b/lib/private/Session/Memory.php index a7b1cd07ead..abbf026899b 100644 --- a/lib/private/Session/Memory.php +++ b/lib/private/Session/Memory.php @@ -94,7 +94,8 @@ class Memory extends Session { * * @param bool $deleteOldSession */ - public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) {} + public function regenerateId(bool $deleteOldSession = true, bool $updateToken = false) { + } /** * Wrapper around session_id -- cgit v1.2.3