Closed TomasVotruba closed 4 months ago
Looking into this.
At the moment we have single AddArrowFunctionReturnTypeRector
to handle these cases. I think it makes sense, as in the wild there is hundreds of methods/functions, but much less callbacks/arrow functions. So it's easier to review these cases without granulation.
We can introduce possibly single rule, e.g. ClosureReturnTypeRector
to handle such cases. That would keep ClassMethod and Fuction_ rules separated, and easier to add types to closure on separete Rector run :)
ClosureReturnTypeRector
can be added, and register after other closure return types rules so executed on last
@samsonasik That's the plan. void
and never
are the easy ones to pick
We've done similar split in the past, to make type declaration level work in as small steps as possible. This would concert few
ReturnType*
rules that now handle all functions, method, closure together.The closure rules should be split of these and have separate rule inside
TypeDeclarationLevel
Ref https://x.com/apefm/status/1803148500693102681