terax6669 opened a new issue, #6717: URL: https://github.com/apache/netbeans/issues/6717
### Apache NetBeans version Apache NetBeans 20 release candidate ### What happened https://www.php-fig.org/per/coding-style/#3-declare-statements-namespace-and-import-statements >The header of a PHP file may consist of a number of different blocks. If present, each of the blocks below MUST be separated by a single blank line, and MUST NOT contain a blank line. Each block MUST be in the order listed below, although blocks that are not relevant may be omitted. > >- Opening <?php tag. >- File-level docblock. >- One or more declare statements. >- The namespace declaration of the file. >- One or more class-based use import statements. >- One or more function-based use import statements. >- One or more constant-based use import statements. >- The remainder of the code in the file. When using Source > Format (`alt+shift+F`) NetBeans correctly detect the blocks and separates them, but the order is not enforced. Only Source > Fix Imports (`ctrl+shift+I`) fixes the order. ```php <?php declare(strict_types=1); namespace Vendor\Package; use const PHP_EOL; use Aws\ControlTower\ControlTowerClient; use function array_merge; use TCG\Voyager\Http\Controllers\Controller; ``` Uses placed after a class are breaking things even further. ```php declare(strict_types=1); namespace Vendor\Package; use const PHP_EOL; use Aws\ControlTower\ControlTowerClient; use function array_merge; class Point { } use TCG\Voyager\Http\Controllers\Controller; ``` `ctrl+shift+I` ```php <?php declare(strict_types=1); namespace Vendor\Package; class Point { } use Aws\ControlTower\ControlTowerClient; use TCG\Voyager\Http\Controllers\Controller; use function array_merge; use const PHP_EOL; ``` This additionally breaks the "singe new-line at the end of file" rule, leaving 2 new lines. ### How to reproduce _No response_ ### Did this work correctly in an earlier version? No / Don't know ### Operating System Windows 11 ### JDK 21.0.1 ### Apache NetBeans packaging Apache NetBeans binary zip ### Anything else _No response_ ### 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
