You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Olexandr Ponomarenko (Jira)" <ji...@apache.org> on 2022/01/24 16:22:00 UTC

[jira] [Created] (NETBEANS-6414) Go to declaration does not work in some circumstances

Olexandr Ponomarenko created NETBEANS-6414:
----------------------------------------------

             Summary: Go to declaration does not work in some circumstances
                 Key: NETBEANS-6414
                 URL: https://issues.apache.org/jira/browse/NETBEANS-6414
             Project: NetBeans
          Issue Type: Bug
          Components: php - Navigation
    Affects Versions: 12.6
         Environment: ** 
Windows 10 64-bit
NetBeans 12.6 binaries
PHP 7.4.27
            Reporter: Olexandr Ponomarenko


The issue seems appears for class file that has "use" statement that has first part of namespace and imported class file the same (MyTest in the following examples). I will describe some strange cases which happen when inclusion of such class name is used. In the following examples resolved/unresolved means class file can or cannot be navigated to in NetBeans using Ctrl-B key binding. Content of included files does not matter.

 
1. With that contents TestHistory is not resolved:

{code:php}
<?php

namespace MyTest\Controller;

use MyTest\Entity\MyTest;
use MyTest\Entity\TestHistory;
use MyTest\Entity\TestOne;
use MyTest\Entity\TestStatus;
use MyTest\Entity\TestTwo;

class TestController
{
}
{code}

2. Adding comment in line with "use MyTest\Entity\MyTest;" makes TestStatus not resolved but others resolvable:

{code:php}
<?php

namespace MyTest\Controller;

use MyTest\Entity\MyTest;   // test
use MyTest\Entity\TestHistory;
use MyTest\Entity\TestOne;
use MyTest\Entity\TestStatus;
use MyTest\Entity\TestTwo;

class TestController
{
}
{code}

3. Using "declare(strict_types=1);" makes TestOne not resolved:

{code:php}
<?php

declare(strict_types=1);

namespace MyTest\Controller;

use MyTest\Entity\MyTest;
use MyTest\Entity\TestHistory;
use MyTest\Entity\TestOne;
use MyTest\Entity\TestStatus;
use MyTest\Entity\TestTwo;

class TestController
{
}
{code}

4. Placing strict types declaration right after opening php tag makes only TestTwo not resolved:

{code:php}
<?php declare(strict_types=1);

namespace MyTest\Controller;

use MyTest\Entity\MyTest;
use MyTest\Entity\TestHistory;
use MyTest\Entity\TestOne;
use MyTest\Entity\TestStatus;
use MyTest\Entity\TestTwo;

class TestController
{
}
{code}

5. Commenting strict types declaration with single comment makes any imported class after line with "use MyTest\Entity\MyTest;" not resolved:

{code:php}
<?php

//declare(strict_types=1);

namespace MyTest\Controller;

use MyTest\Entity\MyTest;
use MyTest\Entity\TestHistory;
use MyTest\Entity\TestOne;
use MyTest\Entity\TestStatus;
use MyTest\Entity\TestTwo;

class TestController
{
}
{code}

6. Adding multi line comment before "use MyTest\Entity\MyTest;" also makes any imported class not resolved (but behaved differently during previous checks yielding only to some classes resolved and some not):

{code:php}
<?php

/**
 * 
 */

declare(strict_types=1);

namespace MyTest\Controller;

use MyTest\Entity\MyTest;
use MyTest\Entity\TestHistory;
use MyTest\Entity\TestOne;
use MyTest\Entity\TestStatus;
use MyTest\Entity\TestTwo;

class TestController
{
}
{code}

There could be other combinations possible but I'm not gonna try every possible scenario as weird behavior is proven to be reproducible. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists