junichi11 opened a new pull request, #7549:
URL: https://github.com/apache/netbeans/pull/7549

   - https://github.com/apache/netbeans/issues/7546
   - Compare segments of namespace names to avoid adding incorrect items
   - Add a unit test
   
   Example:
   ```php
   <?php
   namespace NS1;
   
   class TestClass {}
   class TestClass2TestClass {}
   interface TestInterface {}
   interface TestInterface2TestInterface {}
   trait TestTrait {}
   trait TestTrait2TestTrait {}
   enum TestEnum {
       case Test;
   }
   enum TestEnum2TestEnum {
       case Test;
   }
   
   const CONSTANT = 1;
   const CONSTANT2CONSTANT = 2;
   
   function func(): void {}
   function func2func(): void {}
   
   namespace NS1\Sub1\Sub2\Sub3;
   
   class TestClass {}
   class TestClass2TestClass {}
   interface TestInterface {}
   interface TestInterface2TestInterface {}
   trait TestTrait {}
   trait TestTrait2TestTrait {}
   enum TestEnum {
       case Test;
   }
   enum TestEnum2TestEnum {
       case Test;
   }
   
   const CONSTANT = 1;
   const CONSTANT2CONSTANT = 2;
   
   function func(): void {}
   function func2func(): void {}
   ```
   
   ```php
   namespace Test;
   
   class GH7546 { // Fix Imports here
       private TestClass $testClass1;
       private NS1\Sub1\TestClass $testClass2;
       private TestInterface $testInterface;
       private \NS1\Sub1\Sub2\Sub3\TestInterface $testInterface2;
   
       public const CONSTANT = TestEnum::Test;
       public const int CONSTANT2 = CONSTANT;
   
       use TestTrait;
   
       public function test(): void {
           func();
       }
   }
   ```
   
   Before:
   
   
![nb-php-gh-7546-before](https://github.com/apache/netbeans/assets/738383/20ef1df9-e656-4004-88f7-96cb82886051)
   
   After:
   
   
![nb-php-gh-7546-after](https://github.com/apache/netbeans/assets/738383/d32c2717-70ec-4b57-8ec0-9351e43c6003)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to