diff --git a/build/phprectorconfig.php b/build/phprectorconfig.php index 6cfd629..a2bb3f5 100644 --- a/build/phprectorconfig.php +++ b/build/phprectorconfig.php @@ -31,12 +31,12 @@ codeQuality: true, codingStyle: true, strictBooleans: true, + instanceOf: true, + earlyReturn: true, // carbon: false, deadCode: false, doctrineCodeQuality: false, - earlyReturn: false, - instanceOf: false, naming: false, phpunitCodeQuality: false, privatization: false, diff --git a/make/genchangelog.php b/make/genchangelog.php index 9d820c8..1686ada 100644 --- a/make/genchangelog.php +++ b/make/genchangelog.php @@ -34,7 +34,7 @@ function stristartswith(string $haystack, string $needle): bool function correctAuthor(string $author): string { if ($author === "horstoeko" || $author === "ruff" || $author === "Daniel Erling") { - $author = "HorstOeko"; + return "HorstOeko"; } return $author; diff --git a/make/genmethoddocs.php b/make/genmethoddocs.php index 9c083b0..9463840 100644 --- a/make/genmethoddocs.php +++ b/make/genmethoddocs.php @@ -679,7 +679,7 @@ private function fixPhpType(string $string): string } if ($string === '$this') { - $string = 'static'; + return 'static'; } return $string; diff --git a/src/ZugferdObjectHelper.php b/src/ZugferdObjectHelper.php index db99112..a05d341 100644 --- a/src/ZugferdObjectHelper.php +++ b/src/ZugferdObjectHelper.php @@ -1447,19 +1447,29 @@ public function toDateTime(?string $dateTimeString, ?string $format): ?DateTime if ($format == "102") { return DateTime::createFromFormat("Ymd", $dateTimeString); - } elseif ($format == "101") { + } + + if ($format == "101") { return DateTime::createFromFormat("ymd", $dateTimeString); - } elseif ($format == "201") { + } + + if ($format == "201") { return DateTime::createFromFormat("ymdHi", $dateTimeString); - } elseif ($format == "202") { + } + + if ($format == "202") { return DateTime::createFromFormat("ymdHis", $dateTimeString); - } elseif ($format == "203") { + } + + if ($format == "203") { return DateTime::createFromFormat("YmdHi", $dateTimeString); - } elseif ($format == "204") { + } + + if ($format == "204") { return DateTime::createFromFormat("YmdHis", $dateTimeString); - } else { - throw new ZugferdUnknownDateFormatException($format); } + + throw new ZugferdUnknownDateFormatException($format); } /** @@ -1715,7 +1725,9 @@ public static function isAllNullOrEmpty(array $args): bool foreach ($args as $arg) { if ($arg instanceof DateTime) { return false; - } elseif (!self::isNullOrEmpty($arg)) { + } + + if (!self::isNullOrEmpty($arg)) { return false; } }