rossluk opened a new issue, #5578: URL: https://github.com/apache/netbeans/issues/5578
### Apache NetBeans version Apache NetBeans latest daily build ### What happened There are many issues related to inappropriate place of namespace declarations such as multiple php open tag, declare, not empty first line. Below I'll try to explain the problems and also show the result after possible pull request changes: 1) Import in files with mixed content (php/html) or where is no php code on the first few lines: -- initial state <img width="314" alt="Screen Shot 2023-02-28 at 15 21 50" src="https://user-images.githubusercontent.com/7629403/221887603-6e57b65c-3918-48ff-978a-8e05c809713f.png"> -- after import <img width="435" alt="Screen Shot 2023-02-28 at 13 33 14" src="https://user-images.githubusercontent.com/7629403/221887784-25b15294-9472-4220-a8d2-be45372a6ff2.png"> -- after fix <img width="387" alt="Screen Shot 2023-02-28 at 15 42 26" src="https://user-images.githubusercontent.com/7629403/221887134-95d26dda-4942-421a-8678-787ccf535d5c.png"> 2) declare(ticks=int) inside class or other block structure: --initial state <img width="373" alt="Screen Shot 2023-02-28 at 16 12 28" src="https://user-images.githubusercontent.com/7629403/221896058-62618510-ea83-4949-aca0-f1bb9f9905a8.png"> --after import <img width="417" alt="Screen Shot 2023-02-28 at 16 12 38" src="https://user-images.githubusercontent.com/7629403/221896142-76a2c8bb-4839-44d3-a946-1312c58e88ef.png"> --after fix <img width="372" alt="Screen Shot 2023-02-28 at 16 13 57" src="https://user-images.githubusercontent.com/7629403/221896195-692193e2-cf8f-4717-9bfd-8b46b1793776.png"> 3) Import when declare has block structure or block structure (like function) on first line of the file: --initial state <img width="354" alt="Screen Shot 2023-02-28 at 13 35 09" src="https://user-images.githubusercontent.com/7629403/221890256-ba3f32d0-c7d9-4663-b10c-de7fc762991d.png"> --after import <img width="439" alt="Screen Shot 2023-02-28 at 13 35 28" src="https://user-images.githubusercontent.com/7629403/221890378-9f262e27-6148-445d-817b-468068ced3a3.png"> --after fix (for strict_types declare namespace should and would be after the declare statement, but without strict_types identifier declare could be everywhere) <img width="348" alt="Screen Shot 2023-02-28 at 15 49 05" src="https://user-images.githubusercontent.com/7629403/221890463-c672d0cc-ba43-429c-b8a7-057b37707173.png"> 4) When namespace block is one line in file with multiple php tag blocks: --initial state <img width="382" alt="Screen Shot 2023-02-28 at 15 38 16" src="https://user-images.githubusercontent.com/7629403/221892086-eff04299-b7a5-438f-8502-1f7b850d24df.png"> --after import <img width="373" alt="Screen Shot 2023-02-28 at 15 38 31" src="https://user-images.githubusercontent.com/7629403/221892191-6bc5ba2b-dc38-434a-b94a-489d197ff3ef.png"> --after fix <img width="447" alt="Screen Shot 2023-02-28 at 15 49 23" src="https://user-images.githubusercontent.com/7629403/221892293-5905cfb2-1520-4cdf-b67d-e5f45b2c6834.png"> 5) Multiline comment after namespace or after last use element: --initial state <img width="292" alt="Screen Shot 2023-02-28 at 13 43 33" src="https://user-images.githubusercontent.com/7629403/221892729-3178dc06-744b-424d-87ad-5ff24bbc75dc.png"> --after import <img width="427" alt="Screen Shot 2023-02-28 at 13 43 43" src="https://user-images.githubusercontent.com/7629403/221892777-fd1aa5fd-7e60-439f-a0c5-2ed3867a7670.png"> --after fix <img width="369" alt="Screen Shot 2023-02-28 at 15 49 44" src="https://user-images.githubusercontent.com/7629403/221892862-a76f8bf1-9986-4e1a-92b3-3957600a142f.png"> 6) Not so important, but still an issue related to inappropriate detection of use/namespace elements borders: --initial state <img width="412" alt="Screen Shot 2023-02-28 at 15 40 07" src="https://user-images.githubusercontent.com/7629403/221893567-17c21e0e-f4bd-4536-80f8-706e61824c44.png"> --after import <img width="538" alt="Screen Shot 2023-02-28 at 15 40 49" src="https://user-images.githubusercontent.com/7629403/221893703-ca202025-8290-469d-8594-6497b9f02b08.png"> --after fix <img width="392" alt="Screen Shot 2023-02-28 at 15 50 17" src="https://user-images.githubusercontent.com/7629403/221893854-f88fa55b-a8c6-4cf4-9061-0f14a97426ea.png"> ### How to reproduce Go and run Source->Fix Imports or use Cmd(Ctrl)+Shift+i keys on any of the examples above. ### Did this work correctly in an earlier version? No / Don't know ### Operating System MacOS Mojave Version 10.14.6 ### JDK 13.0.2 ### Apache NetBeans packaging Own source build ### Anything else I used last build for checks, but did a few in Netbeans 14 with same result. ### Are you willing to submit a pull request? Yes -- 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
