Write a linter rule for unexpected return values
Summary:
Although it is technically possible to return a value from a PHP constructor, it is rather odd and should be avoided. See some discussion on StackOverflow. Consider the following example:
class SomeClass { public function __construct() { return 'quack'; } }
This doesn't work:
echo new SomeClas();
This, strangely, does work:
echo id(new SomeClass())->__construct();
Test Plan: Added unit tests.
Reviewers: epriestley, Blessed Reviewers
Reviewed By: epriestley, Blessed Reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D14516