Bug 288799

Summary: PHP classes with namespaces not visible in other files without include
Product: [Applications] kdevelop Reporter: Michal Wazgird <cyrylas>
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: alexander
Priority: NOR    
Version First Reported In: 4.2.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Michal Wazgird 2011-12-12 14:22:42 UTC
Version:           4.2.3 (using KDE 4.7.3) 
OS:                Linux

KDevelop has huge problem locating classes that use namespaces:
- can't locate classes without full namespace path
- cat't locate class class with full namespace, if class definition isn't included.

for example:
file def.php:
----------------------------------
<?php

namespace Foo;

class Bar {
}

// works
$bar = new \Foo\Bar;

// not working
$bar = new Bar;

-----------------------------------

file use.php:
-----------------------------------
<?php

namespace Foo;

include 'def.php';


// not working without include above
$bar = new \Foo\Bar;

// not working
$bar = new Bar;
-----------------------------------


Reproducible: Always

Steps to Reproduce:
Just create files live above.

Actual Results:  
Class Bar is not found and no class help is available.

Expected Results:  
Class Bar should be located without any includes, just like classes without namespaces.

OS: Linux (i686) release 3.0.0-14-generic
Compiler: gcc
Comment 1 Alexander Zhigalin 2018-05-23 14:05:13 UTC
Namespaces fixed