Ban non-void return from __construct, __destruct, __clone?
Open
feature request
hack
low-pri
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
I've found one case of this in Facebook:
```
class Foo {
public function __clone(): Foo {
return new Foo( ... );
}
}
```
This looks like a misunderstanding about how __clone works, as it's called after a copy, instead of to actually do the copy. See http://php.net/manual/en/language.oop5.cloning.php
t5158846 for fixing the issue in Facebook.
Contributor guide
Assessment
This issue has not been assessed yet.