Re: [RFC] Optional typehint check for parameters

From: Date: Mon, 16 Jul 2018 11:14:16 +0000
Subject: Re: [RFC] Optional typehint check for parameters
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-102841@lists.php.net to get a copy of this message
On Mon, Jul 16, 2018 at 1:06 PM Arvids Godjuks <arvids.godjuks@gmail.com> wrote: > пн, 16 июл. 2018 г. в 13:56, Zeljko Mitic <mitke013@gmail.com>: > >> I tried to, but I honestly can't see the problem. No decent programmer >> makes error by sending wrong type of parameter and this feature is 100% >> optional. I know for sure that even in my dev computer, I would use this >> feature, and probably most programmers aware of the issue. >> >> Maybe simpler example: if I send a string to above function, the only >> difference is that PHP would start executing inner code. But an inner line >> like $user->getEmail() would still throw fatal error, still very easy to >> spot. >> >> But again, I really don't see that happening and I am not an expert. And >> I still never make errors like that, not even when I was learning php. And >> if dev computer keeps checking type (default), it is very easy to spot a >> big mistake like that. >> >> Given this is open discussion, I would like to see where I was wrong. >> >> Btw, you were not harsh at all. >> > > Basically, you went wrong when you proposed a switch that controlls > language behavior. To add to that - a switch that probably is not > controllable by code that is running. > > Long story short in a time of php 5.3 - 5.6 it was collectively agreed > that switches that control language execution are evil, are hard to > maintain and having language behave differently due to hosting enforcing > one or the other setting and you as a user having no way to control that is > just bad. Since then, the most evil switches were purged with extreme > pregidece and trying to introduce anything even remotly close to that is a > suicide mission :) > > P.S. RIP magic_quotes, register_globals, short_tags and some other > articats of old. May you never be disturbed again. > > > -- > Arvīds Godjuks > > +371 26 851 664 > arvids.godjuks@gmail.com > Skype: psihius > Telegram: @psihius https://t.me/psihius > Ok, I see your point now. Bit isn't opcache.validate exactly the opposite of that? When user deploys the code, he would not see changes before fpm is restarted. Or worse; if opcache didn't cache some file because it was not called before, more problems would happen. But please, do keep in mind that I would like to have this feature as optional.

« previous php.internals (#102841) next »