What I see mostly to solve this is:
if (null !== ($t=$this->getUseTranslator())) {
// it comes down to the same, but it is slightly more specific
}
Personally, I just ignore the complaints of ZS about assignments in
conditions.
-Bart
Lucas Thompson schreef:
On Wed, Apr 15, 2009 at 6:05 PM, Michael Scholl <[email protected]> wrote:
I read many different things about that…
(Zend Studio throws errors on asssignments in if/while statements)
Would be really interesting how other developers think about that!!!
FWIW, Zend Studio doesn't complain if you nest the assignment in
another set of parenthesis:
<code>
if(($t=$this->getUseTranslator())) {
// no warning from Zend Studio about
}
</code>
Personally, I don't mind that syntax as long as a sane default for $t
is set beforehand.