Czukowski created NETBEANS-6037:
-----------------------------------

             Summary: Fix Imports for PHP code should not reorder groups of use 
statements
                 Key: NETBEANS-6037
                 URL: https://issues.apache.org/jira/browse/NETBEANS-6037
             Project: NetBeans
          Issue Type: Bug
          Components: php - Editor
    Affects Versions: 12.5
         Environment: *Product Version:* Apache NetBeans IDE 12.5

*Java:* 15.0.2; OpenJDK 64-Bit Server VM 15.0.2+7-27

*Runtime:* OpenJDK Runtime Environment 15.0.2+7-27
            Reporter: Czukowski


Please see an example below.

Here, if Fix Imports function (Ctrl+Shift-I) is used, {{use function}} and 
{{use const}} switch places. Depending on which coding standards are being used 
in the project, this change may fail the check and the user would have to 
revert it by hand each time the Fix Imports function is used.

As far as I know, there's no corresponding setting in NetBeans Project 
properties, therefore I think the best behavior would be to leave the {{use}} 
groups ordering as is and only do an alphabetical ordering within each one. 

{code:php}
<?php declare(strict_types = 1);

namespace Cz\Test\FixUsage;

use Generator;
use function sort;
use const SORT_NUMERIC;

class Class1
{
    public function __construct(private array $values)
    {
    }

    public function sortAndIterate(): Generator
    {
        sort($this->values, SORT_NUMERIC);

        foreach ($this->values as $value) {
            yield $value;
        }
    }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
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