Re: [VOTE] Userspace operator overloading
| From: | Dan Ackroyd | Date: | Thu, 09 Apr 2020 12:41:07 +0000 |
| Subject: | Re: [VOTE] Userspace operator overloading | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109580@lists.php.net to get a copy of this message | ||
On Thu, 9 Apr 2020 at 13:18, Dan Ackroyd <Danack@basereality.com> wrote:
> It appears to be the same error case as:
>
And that code had a mistake. Should have been:
```
class A {
public function add(A $rhs) {...}
}
class B {
public function add(A|B $rhs) {...}
}
$a = new A;
$b = new B;
$b->add($a); // Ok
$a->add($b); // TypeError
```
cheers
Dan
Ack