WPS331 should recommend the opposite, so to be explicit about what the returned value is, instead of leaving it to the cognitive load of the reader to understand it.
Thesis
The return statement should not be the place to call additional functions, but should instead only pass variables.
Reasoning
The only reasoning for this rule is that it provides better readability, but I'd argue that
Developers might opt for the first one because saving characters, but if the priority is clarity, there's an additional investigation that one needs to perform with the first option, while the name might clearly giveaway what we're getting in the latter
It's easier to track where the first creation of the variable came to be as without it the actual function that creates bananas might not mention bananas at all, even if that's its only purpose
It allows for easier tracking when traversing the inputs and outputs of a series of functions as the outputs are spelled out
Rule request
WPS331 should recommend the opposite, so to be explicit about what the returned value is, instead of leaving it to the cognitive load of the reader to understand it.
Thesis
The return statement should not be the place to call additional functions, but should instead only pass variables.
Reasoning
The only reasoning for this rule is that it provides better readability, but I'd argue that
is less clear than