Hi, On Mon, Apr 11, 2022 at 3:33 PM G. P. B. <george.bany...@gmail.com> 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 certain circumstances, and > although I agree that changing these to void *would* be the most ideal, > being able to do this communicating that these functions only return true > (which means one can ignore the return value) is the first step. > Moreover, it is even more of a BC break compared to changing something > which only returns false to void as code like: > if (always_true(...)){ ... } > would stop executing this code path. > > Not adding true as a type prevents extending methods which return bool to > always return true to clearly document this within the typesystem. > Then you should probably update the RFC to say that, and better examples ;) Maybe also add an example of "refinement" during inheritance (from `: bool` to `: true`)? One more thing: maybe the part about `true|false` being an error (use `bool`) should be its own subsection, as that's not exactly "redundancy", and differs from `array|\Traversable` being interchangeable with `iterable`. Regards, -- Guilliam Xavier