Version: SVN (using KDE 4.4.3) OS: Linux This happens with KDevelop+related stuff (git master as of 2010-06-14). Note: You have to _type_ this. Simply pasting this code doesn't always show the problem. To reproduce, type the following: class A { }; Now type this inside the curly braces: function f() { $this->mem = 0; } var $mem; At this point KDevelop says "Cannot redeclare int mem (about the "var $mem; line"), already declared in ... (the $this->mem = 0; line)". $mem in "var $mem" has an error squiggle, and "$this->mem" is highlighted as a definition. If you paste the whole chunk, then "var $mem" is read as definition and the error is gone. Reproducible: Always Actual Results: The newly-typed "var $mem;" should be regarded as a definition, not the earlier "$this->mem = 0". openSUSE 11.1 x86_64, gcc 4.3.2. KDE installed from OBS, KDevelop/kdevplatform/plugins compiled manually.
fixed in 1.0 branch, will merge into master laster, thanks.
reopening, pasting something like this into a file triggers this issue: <?php class T { } class B { function x() { $this->a = 1; } var $a = 1; }
Git commit 42d3c0e577e2e4168a4e87d8ab9deceb8e692fd3 by Heinz Wiesinger. Committed on 17/08/2018 at 15:08. Pushed by wiesinger into branch '5.3'. Improved type detection for object properties. Summary: This should solve long standing bugs that make kdev-php difficult to use with common PHP frameworks. * Properly resolve namespaced identifiers for type information in the phpdoc block * Default type for class properties without assigned value is now NULL instead of 'mixed' (if no other type is specified in the phpdoc block) * The NULL type is replaced on first assignment to the property. Related: bug 295866 FIXED-IN: 5.3.0 Reviewers: brauch Reviewed By: brauch Subscribers: brauch, kdevelop-devel Tags: #kdevelop Differential Revision: https://phabricator.kde.org/D14876 M +92 -26 duchain/builders/declarationbuilder.cpp M +14 -3 duchain/builders/typebuilder.cpp M +10 -2 duchain/expressionvisitor.cpp M +97 -11 duchain/tests/duchain.cpp M +2 -0 duchain/tests/duchain.h M +16 -0 duchain/tests/uses.cpp M +1 -0 duchain/tests/uses.h https://commits.kde.org/kdev-php/42d3c0e577e2e4168a4e87d8ab9deceb8e692fd3