From a8efce32670a709ad952bffc67c16a17a69572d5 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Mon, 10 Oct 2022 11:02:42 +0200 Subject: [PATCH] Adjusted detection of `@no-named-arguments` annotations, based on new BetterReflection doc-comment fetching API --- .../BCBreak/FunctionBased/ParameterNameChanged.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php index 7e2ee4d2..fab13a8b 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php @@ -110,7 +110,14 @@ private function compareParameter(ReflectionParameter $fromParameter, Reflection private function methodHasNoNamedArgumentsAnnotation(ReflectionMethod|ReflectionFunction $function): bool { - if ($function instanceof ReflectionMethod && str_contains($function->getDeclaringClass()->getDocComment(), self::NO_NAMED_ARGUMENTS_ANNOTATION)) { + if ($function instanceof ReflectionMethod + && str_contains( + (string) $function + ->getDeclaringClass() + ->getDocComment(), + self::NO_NAMED_ARGUMENTS_ANNOTATION + ) + ) { return true; }