Bug 278085

Summary: kdevelop does not recognize some php language constructs
Product: [Applications] kdevelop Reporter: H.H. <cyberbeat>
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: niko.sams, Teyras
Priority: NOR    
Version: 4.2.2   
Target Milestone: 4.2.3   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description H.H. 2011-07-19 14:03:36 UTC
Version:           4.2.2 (using KDE 4.6.4) 
OS:                Linux

Short example:

abstract class MyAbstractClass {

  static function makeInstanceOfSubclass(){
     $obj = new static();
     return $obj;
  }
}

kdevelop reports problem on "static()":
Problem in Parser: Expected symbol "classNameReference" (current token: "static" [1136] at 415:14 - 415:19)

This piece of code constructs an instance of a subclass of this abstract class and works in php>=5.3.

Reproducible: Always

Steps to Reproduce:
Make a php file with code above


Expected Results:  
there should be no error

OS: Linux (x86_64) release 2.6.37.1-1.2-desktop
Compiler: gcc
Comment 1 Niko Sams 2012-10-28 00:20:31 UTC
confirmed - this is valid php code; static is used for late state binding.
Comment 2 Heinz Wiesinger 2013-07-22 19:37:22 UTC
Git commit 1bf45f0cb2fe95bba2c5a8bc1e7f957d5f12c3b3 by Heinz Wiesinger.
Committed on 18/07/2013 at 13:51.
Pushed by wiesinger into branch 'master'.

Fix support for PHP 5.3's late static binding.

This is still not 100% correct, but since "static" is evaluated at runtime
we can not determine at parsing what class type it really is.
However, it's always gonna be either the class it was declared in or one
that extends the class it was declared in, so using that class as type
should provide better information than for example mixed.
REVIEW: 111598

M  +1    -1    duchain/builders/typebuilder.cpp
M  +6    -5    duchain/expressionvisitor.cpp
M  +11   -0    duchain/helper.cpp
M  +18   -0    duchain/tests/expressionparser.cpp
M  +1    -0    duchain/tests/expressionparser.h
M  +1    -0    parser/php.g

http://commits.kde.org/kdev-php/1bf45f0cb2fe95bba2c5a8bc1e7f957d5f12c3b3
Comment 3 Heinz Wiesinger 2014-01-19 11:06:00 UTC
*** Bug 244073 has been marked as a duplicate of this bug. ***