> Ah, so that's what this is about! In that case, I'd be happy to simply
> always enforce that __construct() cannot return a value, in the same way we
> do for ": void" functions. (If we have backwards compatibility concerns, we
> can add this as a warning instead of hard error.)

I'd approve of that. It'd also be useful to enforce that __construct and other 
magic methods aren't generators,
and that methods from traits renamed to __construct have the same restrictions.

```
php > class X{ public function __construct() { yield 2; }}
php > new X();  // nonsense
php > trait T1 { public function f() { echo "In f\n"; return 2; }}
php > class Z { use T1{ f as __construct; } }
php > new Z();
In f
```

- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to