Re: Re: [RFC] is_literal

From: Date: Fri, 18 Jun 2021 11:01:30 +0000
Subject: Re: Re: [RFC] is_literal
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-114946@lists.php.net to get a copy of this message
On 18.06.21 08:00, Craig Francis wrote:
As there’s been no issues raised with supporting integers, and doing so will help adoption, the implementation will be updated to allow them. Now to choose the name, with the options is_known() from Joe and is_trusted() from Moritz: https://strawpoll.com/bd2qed2xs Keep in mind it might also become a dedicated type in the future.
I think "trusted" is a good option, also if you think about adding it as a type in the future and how it reads for somebody looking through code. Something like public function process(string&trusted $input): string&trusted; Would be good in terms of readability and captures the meaning quite well (although having a specific trusted string type might be more sensible, to avoid these intersection types everywhere). "trusted" could be used in a similar way like the "pure" annotations in Psalm/PHPStan (just for a different meaning of course): to signify where non-trusted variables should be reported and could even be used for whole objects to signify they should only ever get and return trusted variables.

Thread (69 messages)

« previous php.internals (#114946) next »