michael-mammut
michael-mammut

Reputation: 2783

From Eclipse to PhpStorm: Cannot find declaration to go to

I switched from Eclipse to PhpStorm 10. In Eclipse I can go to the class $x = "Xclass"; by Ctrl + left mouse click on "Xclass". But in PhpStrom i get the message : Cannot find declaration to go to.

I'm looking since more than one hour to get it to run.

The problem is that I use this kind of declaration ( $x = "Xclass"; ) very often.

Upvotes: 1

Views: 717

Answers (1)

oshell
oshell

Reputation: 9123

Foo.php

<?php
namespace Foo;

class Foo
{
    private $bar = 'foo';

    public function getBar()
    {
        return $this->bar;
    }
}

index.php

<?php
include 'Foo.php';
use Foo\Foo;

$class = 'Foo\Foo';
$foo = new $class();
echo $foo->getBar();

Navigation on $class = 'Foo\Foo'; won't work by default. You can cropy the class and use Ctrl+N and Ctrl+V to use PhpStorm's Classsearch.

To be able to use Ctrl + Left Mouse you have to install Navigate From Literal.

File > Settings > Plugins > Browse Repositories > Search > Navigate From Literal

If you are using Proxy you have to change the settings before being able to browse the repositories.

Upvotes: 2

Related Questions