Re: proposed access modifier "silent" ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

From: Date: Mon, 11 Apr 2011 18:21:02 +0000
Subject: Re: proposed access modifier "silent" ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-51866@lists.php.net to get a copy of this message
Hi!
I might come off rather crumudgeonly here, but these last few threads I've seen going across to silence notices have a common theme - "I wanna be a lazier coder."
Laziness is a virtue for a coder :) At least, when it goes to avoid unnecessary work - in this example, boilerplate code.
Which is fine - set the PHP error level to not show them.
This is not good enough - "not showed" errors are still generated and are quite expensive.
But don't ask the engine to be rewritten to encourage bad coding practices which failing to properly initialize variables is a prime example of. It's
The case we're dealing with is specifically about providing resolution for the case when the value is not initialized and the default value is provided. It is about making good code easier to write ("$foo[$bar] ?? $baz" instead of "isset($foo[$bar])?$foo[$bar]:$bar"). -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#51866) next »