junichi11 opened a new pull request #2704: URL: https://github.com/apache/netbeans/pull/2704
https://issues.apache.org/jira/browse/NETBEANS-4443 https://wiki.php.net/rfc/named_params #### Part 1 - Fix the parser - Add the `NamedArgument` - Fix the `PHP80UnhandledError` - Add unit tests for the parser - Add `IncorrectNamedArgumentsHintError` to handle incorrect usage ##### PHP 8.0  ##### PHP 7.4  ##### Incorrect Named Arguments Duplicate names:   Positional arguments after named arguments   Combine named arguments and argument unpacking  #### Part 2 - Fix the formatting feature (Don't add spaces before ":") - Add unit tests for the formatting feature Example code: ```php array_fill( start_index : 0, count : 100, value:50); array_fill( value:50, count : 100, start_index :0 ); class ParentClass { public function __construct( public int $foo, public string $bar = "", ) { } } class ExampleClass extends ParentClass { public function __construct( public string $test1, public ?int $test2 = null, ) { parent::__construct(foo: $test1); } public function test(int $test1, string|int $test2 = "") {} public static function staticTest(ExampleClass $exampleClass, int $test) {} } $instance = new ExampleClass($test1, test2: $test2); $instance->test(test1:$test2); ExampleClass::staticTest( exampleClass : $instance, test : $test2); ExampleClass::staticTest( exampleClass : $instance, test : $test2, ); $array_fill = "array_fill"; $array_fill( start_index : 0, count : 100, value : 50); $array_fill( start_index : 0, count : 100, value : 50 ); test(test(1, 2, 3), test3:test(1, 2, 3), test2 : test(1, test2 : 2, test3 : [1, 2, 3])); test( test(1, 2, 3), test3:test(1, 2, 3), test2 : test(1, test2 : 2, test3 : [1, 2, 3]) ); reservedKeyWord( array : []); reservedKeyWord( array : [] ); test( 1, 2, test3 : $test1 === 0 ? 0:1); test( 1, 2, test3 : $test1 === 0 ? 0:1 ); ``` Formatted: ```php array_fill(start_index: 0, count: 100, value: 50); array_fill( value: 50, count: 100, start_index: 0 ); class ParentClass { public function __construct( public int $foo, public string $bar = "", ) { } } class ExampleClass extends ParentClass { public function __construct( public string $test1, public ?int $test2 = null, ) { parent::__construct(foo: $test1); } public function test(int $test1, string|int $test2 = "") { } public static function staticTest(ExampleClass $exampleClass, int $test) { } } $instance = new ExampleClass($test1, test2: $test2); $instance->test(test1: $test2); ExampleClass::staticTest(exampleClass: $instance, test: $test2); ExampleClass::staticTest( exampleClass: $instance, test: $test2, ); $array_fill = "array_fill"; $array_fill(start_index: 0, count: 100, value: 50); $array_fill( start_index: 0, count: 100, value: 50 ); test(test(1, 2, 3), test3: test(1, 2, 3), test2: test(1, test2: 2, test3: [1, 2, 3])); test( test(1, 2, 3), test3: test(1, 2, 3), test2: test(1, test2: 2, test3: [1, 2, 3]) ); reservedKeyWord(array: []); reservedKeyWord( array: [] ); test(1, 2, test3: $test1 === 0 ? 0 : 1); test( 1, 2, test3: $test1 === 0 ? 0 : 1 ); ``` ---------------------------------------------------------------- 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. 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
