13
13
14
14
namespace ApiPlatform \SchemaGenerator \AnnotationGenerator ;
15
15
16
+ use Doctrine \Common \Util \Inflector ;
16
17
use League \HTMLToMarkdown \HtmlConverter ;
17
18
use Psr \Log \LoggerInterface ;
18
19
@@ -106,7 +107,9 @@ public function generateSetterAnnotations(string $className, string $fieldName):
106
107
return [];
107
108
}
108
109
109
- return [sprintf ('@param %s $%s ' , $ this ->toPhpDocType ($ this ->classes [$ className ]['fields ' ][$ fieldName ]), $ fieldName )];
110
+ $ field = $ this ->classes [$ className ]['fields ' ][$ fieldName ];
111
+
112
+ return [sprintf ('@param %s $%s ' , $ this ->toPhpDocType ($ this ->classes [$ className ]['fields ' ][$ fieldName ]), $ field ['name ' ])];
110
113
}
111
114
112
115
/**
@@ -118,7 +121,7 @@ public function generateAdderAnnotations(string $className, string $fieldName):
118
121
return [];
119
122
}
120
123
121
- return [sprintf ('@param %s $%s ' , $ this ->toPhpType ($ this ->classes [$ className ]['fields ' ][$ fieldName ], true ), $ fieldName )];
124
+ return [sprintf ('@param %s $%s ' , $ this ->toPhpType ($ this ->classes [$ className ]['fields ' ][$ fieldName ], true ), Inflector:: singularize ( $ fieldName) )];
122
125
}
123
126
124
127
/**
@@ -130,7 +133,7 @@ public function generateRemoverAnnotations(string $className, string $fieldName)
130
133
return [];
131
134
}
132
135
133
- return [sprintf ('@param %s $%s ' , $ this ->toPhpType ($ this ->classes [$ className ]['fields ' ][$ fieldName ], true ), $ fieldName )];
136
+ return [sprintf ('@param %s $%s ' , $ this ->toPhpType ($ this ->classes [$ className ]['fields ' ][$ fieldName ], true ), Inflector:: singularize ( $ fieldName) )];
134
137
}
135
138
136
139
private function isDocUseful (string $ className , string $ fieldName , $ adderOrRemover = false ): bool
0 commit comments