facebook / facebook/hhvm

Ban non-void return from __construct, __destruct, __clone?

Open
#3,757 3 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.