diff --git a/src/Methods/NoParameterWithContainerTypeDeclarationRule.php b/src/Methods/NoParameterWithContainerTypeDeclarationRule.php index 397914d6..0e282050 100644 --- a/src/Methods/NoParameterWithContainerTypeDeclarationRule.php +++ b/src/Methods/NoParameterWithContainerTypeDeclarationRule.php @@ -150,7 +150,7 @@ private static function createError( string $methodName, string $parameterName, Reflection\ClassReflection $classUsedInTypeDeclaration - ): Rules\IdentifierRuleError { + ): Rules\RuleError { if ($classReflection->isAnonymous()) { $ruleErrorBuilder = Rules\RuleErrorBuilder::message(\sprintf( 'Method %s() in anonymous class has a parameter $%s with a type declaration of %s, but containers should not be injected.',