@@ -412,20 +412,22 @@ public function check(
412412
413413 if ($ nativePropertyReflection ->isReadOnly ()) {
414414 if ($ nativePropertyReflection ->isStatic ()) {
415- $ propertyDescription = sprintf ( 'static readonly property %s::$%s ' , $ propertyReflection -> getDeclaringClass ()-> getDisplayName (), $ propertyReflection -> getName ()) ;
415+ $ errorFormat = 'static readonly property %s::$%s ' ;
416416 } else {
417- $ propertyDescription = sprintf ( 'readonly property %s::$%s ' , $ propertyReflection -> getDeclaringClass ()-> getDisplayName (), $ propertyReflection -> getName ()) ;
417+ $ errorFormat = 'readonly property %s::$%s ' ;
418418 }
419419 } elseif ($ nativePropertyReflection ->isReadOnlyByPhpDoc ()) {
420420 if ($ nativePropertyReflection ->isStatic ()) {
421- $ propertyDescription = sprintf ( 'static @readonly property %s::$%s ' , $ propertyReflection -> getDeclaringClass ()-> getDisplayName (), $ propertyReflection -> getName ()) ;
421+ $ errorFormat = 'static @readonly property %s::$%s ' ;
422422 } else {
423- $ propertyDescription = sprintf ( '@readonly property %s::$%s ' , $ propertyReflection -> getDeclaringClass ()-> getDisplayName (), $ propertyReflection -> getName ()) ;
423+ $ errorFormat = '@readonly property %s::$%s ' ;
424424 }
425425 } else {
426426 continue ;
427427 }
428428
429+ $ propertyDescription = sprintf ($ errorFormat , $ propertyReflection ->getDeclaringClass ()->getDisplayName (), $ propertyReflection ->getName ());
430+
429431 $ errors [] = RuleErrorBuilder::message (sprintf (
430432 '%s is passed by reference so it does not accept %s. ' ,
431433 $ this ->describeParameter ($ parameter , $ argumentName === null ? $ i + 1 : null ),
0 commit comments