@@ -64,21 +64,25 @@ public function processNode(Node $node, Scope $scope): array
6464 $ description = sprintf ('%s %s ' , $ typeDescription , SprintfHelper::escapeFormatString ($ traitName ));
6565 }
6666
67+ $ escapedDescription = SprintfHelper::escapeFormatString ($ description );
68+ $ upperCaseDescription = ucfirst ($ description );
69+ $ escapedUpperCaseDescription = SprintfHelper::escapeFormatString ($ upperCaseDescription );
70+
6771 return $ this ->genericAncestorsCheck ->check (
6872 $ node ->traits ,
6973 array_map (static fn (UsesTag $ tag ): Type => $ tag ->getType (), $ useTags ),
70- sprintf ('%s @use tag contains incompatible type %%s. ' , ucfirst ( $ description ) ),
71- sprintf ('%s @use tag contains unresolvable type. ' , ucfirst ( $ description ) ),
72- sprintf ('%s has @use tag, but does not use any trait. ' , ucfirst ( $ description ) ),
73- sprintf ('The @use tag of %s describes %%s but the %s uses %%s. ' , $ description , $ typeDescription ),
74+ sprintf ('%s @use tag contains incompatible type %%s. ' , $ escapedUpperCaseDescription ),
75+ sprintf ('%s @use tag contains unresolvable type. ' , $ upperCaseDescription ),
76+ sprintf ('%s has @use tag, but does not use any trait. ' , $ upperCaseDescription ),
77+ sprintf ('The @use tag of %s describes %%s but the %s uses %%s. ' , $ escapedDescription , $ typeDescription ),
7478 'PHPDoc tag @use contains generic type %s but %s %s is not generic. ' ,
7579 'Generic type %s in PHPDoc tag @use does not specify all template types of %s %s: %s ' ,
7680 'Generic type %s in PHPDoc tag @use specifies %d template types, but %s %s supports only %d: %s ' ,
7781 'Type %s in generic type %s in PHPDoc tag @use is not subtype of template type %s of %s %s. ' ,
7882 'Call-site variance annotation of %s in generic type %s in PHPDoc tag @use is not allowed. ' ,
7983 'PHPDoc tag @use has invalid type %s. ' ,
80- sprintf ('%s uses generic trait %%s but does not specify its types: %%s ' , ucfirst ( $ description ) ),
81- sprintf ('in used type %%s of %s ' , $ description ),
84+ sprintf ('%s uses generic trait %%s but does not specify its types: %%s ' , $ escapedUpperCaseDescription ),
85+ sprintf ('in used type %%s of %s ' , $ escapedDescription ),
8286 );
8387 }
8488
0 commit comments