Version: git master (using KDE 4.6.2) OS: Linux foreach( $a as $this->_b ){} Expected token ")" after $this. Reproducible: Always Steps to Reproduce: <?php $a = Array( 1, 2); foreach( $a as $this->_b ){} ?> Expected Results: No error :)
*that* is valid php code? Doesn't make any sense! ...but if php supports it, we have too of course :/
it is a valid code. It's just unusual. It's used, for example when you use the value in som internal method, and you dont have a input parameter in it. Or if you wan't to keep the last value for postprocessing. Smarty uses it a lot in compiled code.
Git commit 5bc3469d16a7185d8040193e7ce89bde25cbde26 by Milian Wolff. Committed on 25/07/2011 at 22:04. Pushed by mwolff into branch 'master'. follow php syntax by allow more constructs in foreach statements BUG: 276603 M +10 -5 duchain/builders/usebuilder.cpp M +28 -0 duchain/tests/duchain.cpp M +15 -15 duchain/builders/declarationbuilder.cpp M +1 -0 duchain/tests/duchain.h M +2 -2 parser/php.g http://commits.kde.org/kdev-php/5bc3469d16a7185d8040193e7ce89bde25cbde26