On 16 July 2018 at 14:28, Marco Pivetta <ocram...@gmail.com> wrote: > These don't really need explicit tests in most cases, but rather static > analysis (currently happening via docblocks). Static analysis tools like > vimeo/psalm already pick this up. >
Then why do we need the type hints at all? > I'd even be happy to get type hints that only have effect on > `ReflectionProperty#getType()` as a massive improvement over the current > situation we've monkey-patched us into, but the patch is indeed consistent > with PHP's current state. > I disagree that it's consistent. It introduces an entirely new kind of null reference ("declared but uninitialised"), which will require *more* careful checks than forcing the value to be initially null, and will undoubtedly further annoy those who already claim that isset() is broken (the RFC doesn't even mention it, but I presume uninitialised properties will return false from isset(), but throw an error from is_null()). If all typed properties require a valid default value, the patch is simpler, errors are raised at a line where you can fix them, and the language remains consistent - if you're promised a Foo, you get a Foo, not a "whoops, why isn't there a Foo here?" error. Regards, -- Rowan Collins [IMSoP]