Re: [PHP-DEV] [RFC] Add true as type

2022-04-11 Thread Andreas Hennings
> sketch out a more complete picture for the type system. We can implement it in pieces and parts, but we should have a goal in mind for where we want to land. I think the type system in psalm is pretty cool. It does have fixed literal values, but also deeply structured array types. But: - I don'

Re: [PHP-DEV] NULL Coercion Consistency

2022-04-11 Thread Andreas Leathley
On 11.04.22 20:22, Craig Francis wrote: Just take NULL to String coercion as an example, the documentation clearly and simply says “null is always converted to an empty string”, this needs to be updated to end with "... except when being passed to a function, in which case NULL will result in a T

Re: [PHP-DEV] NULL Coercion Consistency

2022-04-11 Thread Mark Baker
On 11/04/2022 20:22, Craig Francis wrote: Keep in mind, if you're using `strict_types=1`, great, you're not affected (I'm not either)... however, I work with quite a few developers, and it's causing them a lot of problems, and their current approach is to either disable the deprecation warnings,

Re: [PHP-DEV] NULL Coercion Consistency

2022-04-11 Thread Craig Francis
On Mon, 11 Apr 2022 at 16:14, G. P. B. wrote: > But the implementation caused a Type Error when coercing NULL for everyone >> (even when not using *strict_types=1*), this seems more of an over-sight >> > is utterly wrong and was a conscious design choice based on the widely > accepted view that n

Re: [PHP-DEV] [RFC] Add true as type

2022-04-11 Thread Sara Golemon
On Mon, Apr 11, 2022 at 8:59 AM Tim Düsterhus wrote: > For `true` the story is different, as this type is an entirely new type > available to userland and by the same argument one could have literal > strings or literal integers as distinct types as well. I wouldn't object > to that per se (and th

Re: [PHP-DEV] NULL Coercion Consistency

2022-04-11 Thread G. P. B.
On Fri, 8 Apr 2022 at 18:35, Craig Francis wrote: > Hi, > > I've written a new draft RFC to address the NULL coercion problems: > > https://wiki.php.net/rfc/null_coercion_consistency The statement that: > But the implementation caused a Type Error when coercing NULL for everyone > (even when n

Re: [PHP-DEV] NULL Coercion Consistency

2022-04-11 Thread Craig Francis
On Mon, 11 Apr 2022 at 13:05, Guilliam Xavier wrote: > > https://wiki.php.net/rfc/null_coercion_consistency > > You've updated the **Documentation** section (also: did you mean > "inconsistency" rather than "inconstancy"?) but still not the **Proposal** > (BTW all those sections between "Introduc

Re: [PHP-DEV] [RFC] Add true as type

2022-04-11 Thread Tim Düsterhus
Hi On 4/11/22 15:32, G. P. B. wrote: There are many many many more internal functions in PHP which only return true, but only since PHP 8.0.0, and this is due to the huge amount of E_WARNING to ValueError/TypeError promotion which has happened. These functions previously did return false in cert

Re: [PHP-DEV] [RFC] Add true as type

2022-04-11 Thread Guilliam Xavier
Hi, On Mon, Apr 11, 2022 at 3:33 PM G. P. B. wrote: > > There are many many many more internal functions in PHP which only return > true, but only since PHP 8.0.0, and this is due to the huge amount of > E_WARNING to ValueError/TypeError promotion which has happened. > These functions previously

Re: [PHP-DEV] [RFC] Add true as type

2022-04-11 Thread G. P. B.
On Sat, 9 Apr 2022 at 12:05, Tim Düsterhus wrote: > Hi > > On 4/8/22 18:47, G. P. B. wrote: > > Now that null and false can be used as standalone types, I think it > makes a > > lot of sense to add true as a value type for the sake of completeness > with > > false. > > I agree that it would make

Re: [PHP-DEV] NULL Coercion Consistency

2022-04-11 Thread Guilliam Xavier
Hi, > https://wiki.php.net/rfc/null_coercion_consistency Thanks for the draft. On Sat, Apr 9, 2022 at 11:30 AM Craig Francis wrote: > On Fri, 8 Apr 2022 at 19:07, Craig Francis > wrote: > > > On Fri, 8 Apr 2022 at 18:54, Mel Dafert wrote: > > > >> In particular, does this propose changing us