Community
Participate
Working Groups
Since version 7, php no longer validate static operations on parser level. After merge patch from bug 466967 we lost errors for cases like this: class Foo { const MY_CONST = callMe(); } We should reintroduce it via additional checker in ParserBuildParticipant.
I'm thinking about this issue because sometimes driving me crazy :P
New Gerrit change created: https://git.eclipse.org/r/118442
Gerrit change https://git.eclipse.org/r/118442 was merged to [master]. Commit: http://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=f6678825167cfa88694163ede34d0b7010c3a205
I think that this change could have broken something. I have a PHP 5.5 project with this code: <?php class ClassName { protected $propertyName = array( 'test' => 'Foo\Bar', ); } Now PDT marks this property with this error: "Constant expression contains invalid operations" BTW this syntax is valid since PHP 5.0: see https://3v4l.org/5sJL7
The same "Constant expression contains invalid operations" error is reported for this valid code too: <?php function foo($bar = []) { }
New Gerrit change created: https://git.eclipse.org/r/118864
New Gerrit change created: https://git.eclipse.org/r/119013
Gerrit change https://git.eclipse.org/r/119013 was merged to [master]. Commit: http://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=8532d76863e976f28598d9a6af9221563e2d0c8f
Hi Dawid, there are still false positives! Following code is totally valid (tested with PHP 5.4): <?php class AppConfig { public static $connections = array( 'prod' => array( 'user1', 'password1', 'db1' ), 'test' => array( 'user2', 'password2', 'db2' ) ); } ?> Thierry.
Another simpler example that should work, but doesn't validate anymore; <?php class Main { private $_dbConnections = array(); private $_emailFileInfos = array(); }
New Gerrit change created: https://git.eclipse.org/r/119223
Gerrit change https://git.eclipse.org/r/119223 was merged to [master]. Commit: http://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=0289f07fe1bf2817a5f3c343164f6af78cd880e1
Anything else?
It seems ok again ;) I close this bug report and reopen it if necessary. Thank you for the work, Dawid.