thanasis-oob commented on issue #6056:
URL: https://github.com/apache/netbeans/issues/6056#issuecomment-1584253543
Create a new php project.
Create a folling files under the root dir
App\TestClass1.php
```
<?php
namespace App;
class TestClass1{public static function callMe() {return __CLASS__;}}
```
App\TestClass2.php
```
<?php
namespace App;
class TestClass2{public static function callMe() {return __CLASS__;}}
```
App\TestClass3.php
```
<?php
namespace App;
class TestClass3{public static function callMe() {return __CLASS__;}}
```
App\TestClass4.php
```
<?php
namespace App;
class TestClass4{public static function callMe() {return __CLASS__;}}
```
index.php
```
<?php
?>
<!DOCTYPE html>
<html>
<body>
<?php if(1 === 1): ?>
<?php \App\TestClass1::callMe()?>
<?php else: ?>
<?php \App\TestClass2::callMe()?>
<?php endif; ?>
</body>
</html>
```
Then open the index.php fro editing from the netbeans and right click
somewhere in the editor and choose "Fix Imports.." (Ctrl+Shift+I)
the file is tranformed as below
```
<?php
?>
<!DOCTYPE html>
<html>
<body>
<?php if(1 === 1): ?>
<?php TestClass1::callMe() ?>
<?php else: ?>
<?php TestClass2::callMe() ?>
<?php
use App\TestClass1;
use App\TestClass2;
endif; ?>
</body>
</html>
```
Until previous version The file was tranformed as below
```
<?php
use App\TestClass1;
use App\TestClass2;
?>
<!DOCTYPE html>
<html>
<body>
<?php if(1 === 1): ?>
<?php TestClass1::callMe() ?>
<?php else: ?>
<?php TestClass2::callMe() ?>
<?php endif; ?>
</body>
</html>
```
It happened a similar bug in a Class file with one open php tag (<?php) and
namy methods with document comments, but unfortunately I cannot remember how to
reproduce it.
--
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