Search code examples
phpgeany

PHP function definition issues with Geany Editor


In my PHP project I have two different models that have a function with the same.

class Foo
{
    function xyz()
    {
        return "foo";
    }
}

and

class Bar
{
    function xyz()
    {
        return "bar";
    }
}

The problem with Geany is when I try to go to a function definition. Consider the following:

$bla = new Foo();
echo $bla->xyz();

Normally if I CTRL+click on xyz I except it to go to function xyz() in class Foo, but Geany gets completely confused and goes to the definition in Bar.

Is there a way I can make Geany go to the actual definition, not the first one it finds?


Solution

  • Sounds like, this editor has a simple lexer/parser-implementation for PHP with weak class/method/function-indexing. You can do 2 things to improve this scenario:

    1. Use another IDE. Eclipse (PDT or ZendStudio) is a common choice. Many people also use phpStorm or NetBeans. There are others to mention, but I think, these are the big players.
    2. Write a better Plugin for Geany. If Geany is you editor of choice, but it has other strengths which legitimate the usage, its the only way to go. Maybe, there is a better PHP-Plugin already.

    Another thing to mention: Due to PHPs weeknesses in type-hinting, there are a few ways to extend the abilities of some IDEs. Here are some examples: http://code.neox.net/2009/03/10/eclipse-pdt-code-completion-and-zend-framework/