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 --- build/license.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'build/license.php') diff --git a/build/license.php b/build/license.php index ecb7bbd5051..9e2b5f94df4 100644 --- a/build/license.php +++ b/build/license.php @@ -19,8 +19,7 @@ * along with this program. If not, see * */ -class Licenses -{ +class Licenses { protected $paths = []; protected $mailMap = []; protected $checkFiles = []; @@ -80,9 +79,8 @@ EOD; * @param string|bool $gitRoot */ function exec($folder, $gitRoot = false) { - if (is_array($folder)) { - foreach($folder as $f) { + foreach ($folder as $f) { $this->exec($f, $gitRoot); } return; @@ -105,7 +103,7 @@ EOD; $iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS); $iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($folder, $excludes) { /** @var SplFileInfo $item */ - foreach($excludes as $exclude) { + foreach ($excludes as $exclude) { if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) { return false; } @@ -178,7 +176,7 @@ With help from many libraries and frameworks including: */ private function isMITLicensed($source) { $lines = explode(PHP_EOL, $source); - while(!empty($lines)) { + while (!empty($lines)) { $line = $lines[0]; array_shift($lines); if (strpos($line, 'The MIT License') !== false) { @@ -191,7 +189,7 @@ With help from many libraries and frameworks including: private function isOwnCloudLicensed($source) { $lines = explode(PHP_EOL, $source); - while(!empty($lines)) { + while (!empty($lines)) { $line = $lines[0]; array_shift($lines); if (strpos($line, 'ownCloud, Inc') !== false || strpos($line, 'ownCloud GmbH') !== false) { @@ -209,7 +207,7 @@ With help from many libraries and frameworks including: private function eatOldLicense($source) { $lines = explode(PHP_EOL, $source); $isStrict = false; - while(!empty($lines)) { + while (!empty($lines)) { $line = $lines[0]; if (trim($line) === 'checkFiles[] = $path; - } private function printFilesToCheck() { -- cgit v1.2.3