Hi 2015-03-11 6:50 GMT-03:00 Patrick ALLAERT <patrickalla...@php.net>:
> Le mar. 10 mars 2015 à 21:04, Marcio Almada <marcio.w...@gmail.com> a > écrit : > >> >> >> 2015-03-10 12:31 GMT-03:00 Patrick ALLAERT <patrickalla...@php.net>: >> >>> Hello, >>> >>> Le lun. 2 mars 2015 à 00:03, Marcio Almada <marcio.w...@gmail.com> a >>> écrit : >>> >>> >>> I'm globally +0.5, however I have some concerns: >>> >>> What about constructors? [...] >>> >> I think this is somehow covered here >>> https://wiki.php.net/rfc/strict_argcount#hassle_factor, the example is >>> not explicit to ctors but the same principles seem to apply. Not sure you >>> have a deeper point on it though as PHP is a weirdo and allows constructors >>> on interfaces. >>> >>> Also, FYI, before we reach discussion phase, there was an idea to ignore >>> ctors and other magic methods but you are the first person to bring it up >>> on the ML. I'm not very inclined to ignore any other magic methods other >>> than *__call* and *__callStatic* for now. >>> >> > No deep point, just wanted to bring your attention on it. > >> >> >>> E_WARNING: >>> -1, IMHO, calling functions/methods with more arguments generally has >>> less impact than other aspects that currently generate E_NOTICES (e.g. >>> using undefined variables, constants,...). Using an error reporting level >>> stronger than for those cases looks inconsistent. >>> >> >> I disagree with the "looks inconsistent" part. The E_WARNING option would >> actually be the most consistent with current PHP behavior. Ex: >> >> function fn($a, $b){} >> fn(1); >> PHP warning: Missing argument 2 for fn(), called in... >> >> If we choose E_WARNING both minimum and maximum argument count will have >> the same error level. BTW, in some cases an exceeding argument can be even >> more dangerous than a missing argument. >> > > You have a (debatable) point :) > > It depends according to what aspect of PHP your are comparing it with. > Greping zend_error(E_NOTICE,.*) in the code I had the feeling that already > many notices where the sign of a bigger problem than when passing extra > parameters, hence why I suggested E_NOTICE. > > My consistency argument was therefore "severity based". > Ok, that's a good POV. It just turns out that the severity may vary from case to case. > I have no strong feelings regarding to the error level, the E_WARNING vs >> E_NOTICE seems legit so I'm waiting for more opinions. >> > > I wouldn't -1 for E_WARNING because of your extra arguments (sorry for the > pun ;), someone had to do it!). Still in favor of E_NOTICE though. > > That's great to know. Looks like E_WARNING vs E_NOTICE vs E_STRICT seems to be good setup even though I still don't like to have 3 options though. > Patrick > Thanks, Márcio