Re: [RFC] anti-coalescing-operator

From: Date: Fri, 25 Oct 2019 06:42:30 +0000
Subject: Re: [RFC] anti-coalescing-operator
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-107689@lists.php.net to get a copy of this message
> Le 25 oct. 2019 à 04:31, Ken Stanley <dohpaz@gmail.com> a écrit : > > If the parameter is null able, I may need to add an if condition to look up > a sane default value when the parameter comes through as null. It would be > much more succinct (and less error prone) to be able to say something like > > /** > * @ParamConverter(name=“application”, ...) > */ > public function myAction(Request $request, Application $application) > { > $user = $application->getUser() !?? $this->getUser(); > > // ... do something with user, without worrying about it being null. > } > Did you meant: $user = ($application ?? $this)->getUser(); ? —Claude

« previous php.internals (#107689) next »