Re: [PHP-DEV] Two Issues regarding Named Parameters; want to understand the technicality
Hi Kamil, Thank you for your response. I shall sure create an issue and will update in this threat. On 3/9/23, Kamil Tekiela wrote: > Hi Hamza, > > If you encounter a bug, please create a GitHub issue with reproducible > steps. Your description of a program crashing is not actionable, as we > cannot reproduce this error. > > Regarding your second point, how do you want this to work? $names is just a > collection of string parameters. It's not a single parameter so you cannot > refer to it by name. When you use named parameters with variadic > parameters, then the names you specified will be used as array keys. So no > error there, and no warning should be raised. But I don't know what you had > in mind of how this is supposed to work. > > Regards, > Kamil > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
Re: [PHP-DEV] Two Issues regarding Named Parameters; want to understand the technicality
Hi Hamza, If you encounter a bug, please create a GitHub issue with reproducible steps. Your description of a program crashing is not actionable, as we cannot reproduce this error. Regarding your second point, how do you want this to work? $names is just a collection of string parameters. It's not a single parameter so you cannot refer to it by name. When you use named parameters with variadic parameters, then the names you specified will be used as array keys. So no error there, and no warning should be raised. But I don't know what you had in mind of how this is supposed to work. Regards, Kamil
[PHP-DEV] Two Issues regarding Named Parameters; want to understand the technicality
Hello Internals, I am writing to discuss an issue that I have encountered while using named parameters in two of my projects. Although named parameters have made it easier to call functions without passing extra parameters, I have found that relying solely on them can cause problems. In my first project, I have been using named parameters while calling com methods of Office VBA, as advised by Microsoft Docs. However, when I try to use named parameters in PHP, my program crashes, and I have to manually close any open applications. I would like to request a fix for this issue. If it is impossible to obtain the list of parameter names in COM, could we receive a warning instead? If the list of parameter names is obtainable, it would be great if this could be fixed in version 8.3 or earlier. In my second project, I did not receive a warning when I passed the wrong parameters. To give you an example, I have two constructors: 1. ` public function __construct(int $date, int$month, int $year) ` 2. ` public function __construct(string ...$names) ` When I initialized the latter object with the former object's signature i.e., `new LatterObject(date: 1, month: 1, year: 1970); `, I did not receive a warning of passing the wrong parameters. I would appreciate it if you could look into these issues and provide me with any suggestions for solutions. Thank you for your prompt attention to this matter. Best regards, [Hamza Ahmad] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php