Re: [RFC] Keep type of reference params

From: Date: Mon, 04 May 2020 15:43:52 +0000
Subject: Re: [RFC] Keep type of reference params
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-109990@lists.php.net to get a copy of this message
---- En lun, 04 may 2020 15:01:44 +0200 Matthew Brown <matthewmatthew@gmail.com> escribió ---- > This would break quite a lot of existing code, though PHP could add an > explicit keyword like "inout" that catches this behaviour (see example in > Hack: https://docs.hhvm.com/hack/functions/inout-parameters). > > Today these issues can also be caught with static analysis: > https://psalm.dev/r/1f670956ab Thanks, Matthew, I don't know about inout. I think I’d be positive of adding inout keyword in order to: - Check type of out is equal to type of param( like example of my first email ). - Avoid modifying caller var value when the function throws an exception Other option is adding to normal reference( & ) these behaviours when strict_types will be activated in caller. Regards -- Manuel Canga

« previous php.internals (#109990) next »