This forum has been archived. All content is frozen. Please use KDE Discuss instead.

PHP Namespaces - "Declaration not found" struggle

Tags: None
(comma "," separated)
Kachna
Registered Member
Posts
2
Karma
0
Hello!
I use KDevelop for Symfony 2 bundle development, and I struggle to make the actual namespace recognition work.
I can see all classes in the project just fine, however I work in a namespace such as:
Code: Select all
namespace Keboola\ElasticSearchWriterBundle\Writer;


Then if I declare a class and a function right there:
Code: Select all
class ElasticSearchWriter {
   protected $log;
   public function setLogger(\Monolog\Logger $logger) {
      $this->log = $logger;
   }
}

KDevelop cannot find the class. If I, however, remove the leading "\" in the function definition:
Code: Select all
class ElasticSearchWriter {
   protected $log;
   public function setLogger(Monolog\Logger $logger) {
      $this->log = $logger;
   }
}

The class is found by KDevelop and displays just fine. However, that code doesn't work, because PHP is looking for the class in current namespace if the leading backslash isn't present.

Using the "use" declaration instead doesn't seem to help, as the class isn't found either:
Code: Select all
use   Syrup\ComponentBundle\Exception\SyrupComponentException as Exception,
   Keboola\StorageApi\Table;


The tooltip in both cases reads:
Problem in Definition-Use Chain:
Declaration not found: Table


Where Table is obviously the class in question.

Is that a problem with my configuration, or is that actually a bug in the PHP module? I couldn't find any mention of that googling around, though I may have missed something.

Thanks!
Kachna
Registered Member
Posts
2
Karma
0
Sorry, failed to mention versions and stuff!
KDevelop Platform
Version 1.6.0
Using KDE Development Platform 4.11.5


KDevelop
Version 4.6.0
Using KDE Development Platform 4.11.5


PHP Support
Version 1.6.0
Using KDE Development Platform 4.11.5


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]