Page MenuHomePhabricator

Phan should object to @return that doesn't have a return
Closed, ResolvedPublic0 Estimated Story Points

Event Timeline

Can't we implement this in MediaWiki-Codesniffer instead? That's faster to run, and the check is fairly simplistic - verify that the method contains T_RETURN or T_YIELD when the accompanying docblock contains @return.

I'd not be against having a rule in CodeSniffer, but this is really something that our static analysis tool should spot regardless. :-)

codesniffer is looking the other way round, so having a return with a value and not @return it would be an issue.

T168994 can improve the situation are also covered by changes to this task.

The phan config contains some disabled issue.
A issue to the return it is only PhanTypeMismatchReturn but that is only for types and I have not tested, if it can find the actual void vs. the type from @return

Change 517740 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] phan: Enable PhanTypeMismatchReturn issue

Fixed by patch sets for T231636