https://bugs.kde.org/show_bug.cgi?id=373416

            Bug ID: 373416
           Summary: Classes not recognized when using absolute namespace
                    name
           Product: kdevelop
           Version: 5.0.3
          Platform: Archlinux Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Language Support: PHP
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: jan.pavli...@centrum.cz
  Target Milestone: ---

When using a class from another namespace in file that is also in a namespace,
one needs to prepend the full class name with a backslash to indicate absolute
path. But KDevelop fails to recognize the class with the backslash. When I
remove the backslash, class is recognized (is colored and can be jumped to),
but the code no longer works, because the class does not exist (it's path is
resolved relative to current namespace). Demonstration:

file1.php
<?php 
namespace Test;
class A
{

}
?>

file2.php - working PHP code, but new \Test\A; is not recognized
<?php
namespace Test2;
class B
{
  public $class_a;

  public function __construct()
  {
    $this->class_a = new \Test\A;
  }
}
?>

file3.php - non working PHP code (class gets resolved to Test2\Test\A, which
does not exist), but new \Test\A; is recognized as Test\A by KDevelop
<?php
namespace Test2;
class B
{
  public $class_a;

  public function __construct()
  {
    $this->class_a = new Test\A;
  }
}
?>

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to