diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/AppFramework/Utility | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
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 <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/AppFramework/Utility')
-rw-r--r-- | lib/private/AppFramework/Utility/ControllerMethodReflector.php | 6 | ||||
-rw-r--r-- | lib/private/AppFramework/Utility/SimpleContainer.php | 4 | ||||
-rw-r--r-- | lib/private/AppFramework/Utility/TimeFactory.php | 1 |
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/private/AppFramework/Utility/ControllerMethodReflector.php b/lib/private/AppFramework/Utility/ControllerMethodReflector.php index 31f1892772f..2b7420cd41b 100644 --- a/lib/private/AppFramework/Utility/ControllerMethodReflector.php +++ b/lib/private/AppFramework/Utility/ControllerMethodReflector.php @@ -82,7 +82,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { } $default = null; - if($param->isOptional()) { + if ($param->isOptional()) { $default = $param->getDefaultValue(); } $this->parameters[$param->name] = $default; @@ -97,7 +97,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { * would return int or null if not existing */ public function getType(string $parameter) { - if(array_key_exists($parameter, $this->types)) { + if (array_key_exists($parameter, $this->types)) { return $this->types[$parameter]; } @@ -128,7 +128,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { * @return string */ public function getAnnotationParameter(string $name, string $key): string { - if(isset($this->annotations[$name][$key])) { + if (isset($this->annotations[$name][$key])) { return $this->annotations[$name][$key]; } diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 1703df3ea73..44bda1c3e6b 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -102,7 +102,7 @@ class SimpleContainer extends Container implements IContainer { throw new QueryException($baseMsg . ' Class can not be instantiated'); } - } catch(ReflectionException $e) { + } catch (ReflectionException $e) { throw new QueryException($baseMsg . ' ' . $e->getMessage()); } } @@ -140,7 +140,7 @@ class SimpleContainer extends Container implements IContainer { */ public function registerService($name, Closure $closure, $shared = true) { $name = $this->sanitizeName($name); - if (isset($this[$name])) { + if (isset($this[$name])) { unset($this[$name]); } if ($shared) { diff --git a/lib/private/AppFramework/Utility/TimeFactory.php b/lib/private/AppFramework/Utility/TimeFactory.php index b3d5ec831d1..30ab9bd3098 100644 --- a/lib/private/AppFramework/Utility/TimeFactory.php +++ b/lib/private/AppFramework/Utility/TimeFactory.php @@ -52,5 +52,4 @@ class TimeFactory implements ITimeFactory { public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { return new \DateTime($time, $timezone); } - } |