Two Issues regarding Named Parameters; want to understand the technicality

From: Date: Thu, 09 Mar 2023 00:26:43 +0000
Subject: Two Issues regarding Named Parameters; want to understand the technicality
Groups: php.internals 
Request: Send a blank email to internals+get-119673@lists.php.net to get a copy of this message
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]

« previous php.internals (#119673) next »