hbrecht opened a new issue, #7546:
URL: https://github.com/apache/netbeans/issues/7546
### Apache NetBeans version
Apache NetBeans 22
### What happened
When you have two classes where where the second class has name of first
class as prefix and postfix (eg class "Test" and class "TestMyTest") and you
use the first class (Test) in the same namespace, the "Fix imports" will always
select "TestMyTest" although the name does not match.
If you use them from a different namespace, there is no automatic selection,
but the selected class in the drop down is again TestMyTest``
### Language / Project Type / NetBeans Component
PHP project
### How to reproduce
Create three classes (separate files):
1. Class:
<?php
declare(strict_types=1);
namespace Issue;
class Test {
}
2. Class
<?php
declare(strict_types=1);
namespace Issue;
class TestMyTest {
}
3. Class
<?php
declare(strict_types=1);
namespace Issue;
class Main {
private Test $test;
}
Then call "Fix imports" in class Main. It will replace "private Test $test"
with "private TestMyTest $test".
When you revert the change and then remove the namespace in Main.php and do
"Fix imports", it will suggest "\Issue\TestMyTest" in the dropdown. It will
also show "\Issue\Test", but it is not pre-selected.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Debian 12
### JDK
OpenJDK 17.0.11
### Apache NetBeans packaging
Apache NetBeans Snap Package, Other
### Anything else
always
### Are you willing to submit a pull request?
No
--
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