From 24142f7c1cad12c84c5e48abc07b5d57a6983b0b Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Thu, 2 Feb 2023 13:53:43 +0100 Subject: [PATCH] cs: enable RequireMultiLineMethodSignature (#80) --- phpcs.xml.dist | 1 + src/Rule/EnforceNativeReturnTypehintRule.php | 7 ++++++- ...ocNullabilityMismatchWithNativeTypehintRule.php | 7 ++++++- src/Rule/RequirePreviousExceptionPassRule.php | 14 ++++++++++++-- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c4644a2..c3f567e 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -270,6 +270,7 @@ + diff --git a/src/Rule/EnforceNativeReturnTypehintRule.php b/src/Rule/EnforceNativeReturnTypehintRule.php index 3532f96..a5d3105 100644 --- a/src/Rule/EnforceNativeReturnTypehintRule.php +++ b/src/Rule/EnforceNativeReturnTypehintRule.php @@ -294,7 +294,12 @@ private function getUnionTypehint(Type $type, Scope $scope, bool $typeFromPhpDoc return implode('|', $typehintParts); } - private function getIntersectionTypehint(Type $type, Scope $scope, bool $typeFromPhpDoc, bool $alwaysTerminating): ?string + private function getIntersectionTypehint( + Type $type, + Scope $scope, + bool $typeFromPhpDoc, + bool $alwaysTerminating + ): ?string { if (!$type instanceof IntersectionType) { return null; diff --git a/src/Rule/ForbidPhpDocNullabilityMismatchWithNativeTypehintRule.php b/src/Rule/ForbidPhpDocNullabilityMismatchWithNativeTypehintRule.php index 21c7695..0332453 100644 --- a/src/Rule/ForbidPhpDocNullabilityMismatchWithNativeTypehintRule.php +++ b/src/Rule/ForbidPhpDocNullabilityMismatchWithNativeTypehintRule.php @@ -200,7 +200,12 @@ private function getPhpDocParamType(FunctionLike $node, Scope $scope, string $pa /** * @return list */ - private function comparePhpDocAndNativeType(?Type $phpDocReturnType, ?Type $nativeReturnType, Scope $scope, string $phpDocIdentification): array + private function comparePhpDocAndNativeType( + ?Type $phpDocReturnType, + ?Type $nativeReturnType, + Scope $scope, + string $phpDocIdentification + ): array { if ($phpDocReturnType === null || $nativeReturnType === null) { return []; diff --git a/src/Rule/RequirePreviousExceptionPassRule.php b/src/Rule/RequirePreviousExceptionPassRule.php index 778437e..072ea1c 100644 --- a/src/Rule/RequirePreviousExceptionPassRule.php +++ b/src/Rule/RequirePreviousExceptionPassRule.php @@ -97,7 +97,13 @@ public function processNode(Node $node, Scope $scope): array /** * @return list */ - private function processExceptionCreation(bool $strictTypes, ?string $caughtExceptionVariableName, Type $caughtExceptionType, CallLike $node, Scope $scope): array + private function processExceptionCreation( + bool $strictTypes, + ?string $caughtExceptionVariableName, + Type $caughtExceptionType, + CallLike $node, + Scope $scope + ): array { $passed = false; @@ -170,7 +176,11 @@ private function getCallLikeParameters(CallLike $node, Scope $scope): array /** * @param Name[] $exceptionNames */ - private function getCaughtExceptionType(array $exceptionNames, Scope $scope, Type $exceptionTypesCaughtInPreviousCatches): Type + private function getCaughtExceptionType( + array $exceptionNames, + Scope $scope, + Type $exceptionTypesCaughtInPreviousCatches + ): Type { $classes = [];