On 16/11/2021 09:27, Andreas Heigl wrote:

I see, yes, code that is 100% perfectly tested can get away without the language performing any error checking at all - the behaviour is all guaranteed by the tests. I would be very surprised if even 1% of PHP applications can claim such comprehensive tests.

The topic here was that new code can verify the declaration of a property by using tests. That does not need to happen on the language level. I was never talking about adding tests for existing code.


Whether the code is "new" or "old" is not what matters; what matters is whether the test suite is comprehensive enough that every possible mistake will be caught by a test. If it will, we can remove a whole bunch of language features - why use parameter and property types, for instance, if your tests guarantee that they will always be given correct values?

For most code bases, even new ones being written from scratch in PHP 8.0, that level of testing simply doesn't exist, and having the language tell you "hey, you wrote $this->loger instead of $this->logger" is a useful feature. And, in a lot of cases, more useful than having the language say "OK, I've created your dynamic $loger property for you", which is what currently happens.


Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to