Page MenuHomePhabricator

How to handle return in __construct inside codesniffer
Closed, ResolvedPublic

Description

The class MssqlBlob in mediawiki/core has a return inside the constructor. This is valid php code, but the function documentation sniff now wants a @return for this return statement. It seems not useful to have a @return just to make the sniff happy.

Do we want return in constructor or should it rewritten by use a static factory method here? Adding a ignore tag seems not futureproofed.

If there should not be a return in constructor there could be sniff, when it is okay, the FunctionCommentSniff needs an adjustment.

T168994 needs also a comment about this decision, if the return is okay in construct, because the requested sniff should not detect it.

Event Timeline

Change 402603 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/tools/codesniffer@master] Skip __construct on checking for @return tags

https://gerrit.wikimedia.org/r/402603

Change 402603 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Skip __construct on checking for @return tags

https://gerrit.wikimedia.org/r/402603

Umherirrender claimed this task.
Umherirrender triaged this task as Medium priority.