class SomeStruct{ public int $a; }
class Joe
{
public SomeStruct $struct;
function test1() : SomeStruct{
return new SomeStruct(); // TypeError: can't return
a type whose fields' type declarations aren't fulfilled
}
function test2(SomeStruct $struct){ // TypeError: can't pass in
a type whose fields' type declarations aren't fulfilled [*]
}
function test3(){
$this->struct = new SomeStruct(); // TypeError: can't assign
to a typed field a type whose fields' type declarations aren't fulfilled
}
}
(new Joe)->test2(new SomeStruct()); // [*]
2016-03-16 19:41 GMT+01:00 Johannes Schlüter <[email protected]>:
> On Wed, 2016-03-16 at 19:15 +0100, Bob Weinand wrote:
> >
> > Eih, only to typed properties. Everything else would be insane ;-)
> > Sorry for being imprecise.
>
> Ok, quite a lot better, but still weird difference to the language.
>
>
> There's a notable amount of places where references are being used and
> often users aren't aware. (Binding parameters in database queries, in
> order to support OUT parameters, comes to mind, many array functions
> take an array, some functions use it to report error codes, ...)
>
> I guess this will be a famous support issue.
>
> And yeah, I'd love to "fix" all those places and get rid of the
> references, but BC ... it's quite massive :-)
>
>
> johannes
>