Bug 278085 - kdevelop does not recognize some php language constructs
Summary: kdevelop does not recognize some php language constructs
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: PHP (show other bugs)
Version: 4.2.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: 4.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 244073 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-19 14:03 UTC by H.H.
Modified: 2014-01-19 11:06 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***