junichi11 opened a new pull request, #5758:
URL: https://github.com/apache/netbeans/pull/5758

   - https://github.com/apache/netbeans/issues/4609
   - PSR-12: 
https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements
   - Fix the formatter
   - Fix the preview file
   
   
![nb-php-gh-4609-formatter](https://user-images.githubusercontent.com/738383/229252235-7d98a26d-3753-473d-9a23-67c132f84331.png)
   
   - Fix "Fix imports"
   - Add `FixImportsBottomPanel` as a bottom panel of `FixDuplicateImportsStmts`
   
   Example:
   ```php
   <?php
   class TestClass implements MyInterface {
       use MyTrait;
       public function test(): void {
           $a = new MyClass();
           CONSTANT_B;
       }
   }
   CONSTANT_A;
   MyEnum::Case1;
   functionA();
   ```
   Inserted (Checked "Put in PSR-12 order"):
   ```php
   <?php
   namespace Test;
   
   use Vendor\Package\{
       Classes\MyClass,
       Enums\MyEnum,
       Interfaces\MyInterface,
       Traits\MyTrait
   };
   
   use function Vendor\Package\Functions\functionA;
   
   use const Vendor\Package\Constants\{
       CONSTANT_A,
       CONSTANT_B
   };
   
   class TestClass implements MyInterface {
       use MyTrait;
       public function test(): void {
           $a = new MyClass();
           CONSTANT_B;
       }
   }
   CONSTANT_A;
   MyEnum::Case1;
   functionA();
   ```
   
   Before:
   
![nb-php-gh-4609-fix-imports-before](https://user-images.githubusercontent.com/738383/229252385-c1117831-4e56-49eb-be53-1f81b2c20d21.png)
   
   After:
   
![nb-php-gh-4609-fix-imports-after](https://user-images.githubusercontent.com/738383/229252613-43ec8e9d-aad4-476e-b137-ddb63c86e4d3.png)
   
   - Don't add a space before `{`
   - Don't generate full class names in the panel
   
   #### NOTE
   The following is not supported yet.
   
   ```
   Compound namespaces with a depth of more than two MUST NOT be used. 
Therefore the following is the maximum compounding depth allowed:
   ```
   ```php
   <?php
   
   use Vendor\Package\SomeNamespace\{
       SubnamespaceOne\ClassA,
       SubnamespaceOne\ClassB,
       SubnamespaceTwo\ClassY,
       ClassZ,
   };
   ```
   


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