riksoft opened a new issue, #7462:
URL: https://github.com/apache/netbeans/issues/7462

   ### Apache NetBeans version
   
   Apache NetBeans 22
   
   ### What happened
   
   The code inside a function influences how is formatted the code into another 
function when making use of ALT+Shift+F
   I already filed this bug that is a similar problemi for JS 
(https://github.com/apache/netbeans/issues/7243) but this one I think it's even 
worse.
   
   ### Language / Project Type / NetBeans Component
   
   PHP project
   
   ### How to reproduce
   
   (1) Comment the line
   $res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
   and press ALT Shift+F
   You'll see "Array(" in the function stuff() moving in the right position.
   (2)
   Remove the comment from
   $res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
   and "array(" will move again in the bad position.
   (3)
   In the line
   $res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
   change "test3" with "test33333333333333333333" and you'll see "array(" 
moving further right.
   I haven't found any workaround to solve this problem.
   
   `<?php
   
   class test
   {
        public static function test($res)
        {
                $test4 = [1, 2, 3, 4];
   
                // The lenght of this line changes the format position of 
"array("
                // in function stuff() :-o !!!
                // E.g. try to change test3 into test333333
                // and format the code again: "array(" will be moved further 
right.
                // Or simply comment the following line and reformat
                $res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', 
$test4)];
   
                return $res;
        }
   
   
        public static function stuff()
        {
                return array_merge(self::registerRules(),
                                                                                
 array(
                         'opt1' => FILTER_SANITIZE_NUMBER_INT,
                         'opt2' => FILTER_SANITIZE_NUMBER_INT
                  )
                );
        }
   }`
   
   PS: If this could help, I format all my code with tabs, not spaces.
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Debian Bookworm (12)
   
   ### JDK
   
   Java: 17.0.11; OpenJDK 64-Bit Server VM 17.0.11+9-Debian-1deb12u1 - Runtime: 
OpenJDK Runtime Environment 17.0.11+9-Debian-1deb12u1
   
   ### 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

Reply via email to