thanasis-oob opened a new issue, #6056:
URL: https://github.com/apache/netbeans/issues/6056

   ### Apache NetBeans version
   
   Apache NetBeans 18
   
   ### What happened
   
   After updating the program to the latest version 18, I noticed that the "Fix 
imports" functionality in a php file, adds the use Classes in wrong places of 
the file.
   
   ### How to reproduce
   
   Case 1
   On a new PHP project.
   Add some namespaced classes with methods and doc methods.
   Call some classes inside a class method, then right click on the file editor 
area and from the context menu choose the "Fix imports...".
   Until previous version "Fix imports..." functionality, detects all non 
imported classes, shows a popup with the found classes and then adds "use 
/NamespePath/Class1;" statement after the first  "<?php" and after the 
namespace statement.
   
   Case 2
   create a new php file.
   Open a new <?php ?> tag
   then write html and mix <?php ?> tags that calls namespaced classes
   use the "Fix imports..."
   The use statements are added inside the last <?php ?> tag.
   
   
   
   
   
   ### Did this work correctly in an earlier version?
   
   Apache NetBeans 17
   
   ### Operating System
   
   Ubuntu 22.04
   
   ### JDK
   
   11.0.19; OpenJDK 64-Bit Server VM 11.0.19+7-post-Ubuntu-0ubuntu122.04.1
   
   ### Apache NetBeans packaging
   
   Apache NetBeans Snap Package
   
   ### Anything else
   
   before Fix imports..."
   ```
   <?php
   
   /** @var EntityActionManager  $entityActionManager  */
   ?>
       <?php foreach($scripts as $script): ?>
           <?php if(!AppManager::get()->hasLoadedScript($script)): ?>
               <script type="text/javascript" src="<?= e(asset($script)) 
?>"></script>
           <?php endif; ?>
       <?php endforeach; ?>
   ````
   
   After before Fix imports..."
   ```
   <?php
   
   
   /** @var EntityActionManager  $entityActionManager  */
   
   ?>
   
   
       <?php foreach($scripts as $script): ?>
           <?php if(!AppManager::get()->hasLoadedScript($script)): ?>
               <script type="text/javascript" src="<?= e(asset($script)) 
?>"></script>
           <?php endif; ?>
       <?php 
   
   use App\Logic\App\AppManager;
   use App\Logic\App\EntityActionManager;
   endforeach; ?>
   
   ````
   
   ### 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

Reply via email to