Add passthrough arguments to PHP binary via -- separator#90
Add passthrough arguments to PHP binary via -- separator#90swissspidy merged 12 commits intomainfrom
-- separator#90Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
-- separator
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| $cmd_args[] = $assoc_args['config']; | ||
| $cmd_args[] = Utils\extract_from_phar( $router_path ); | ||
|
|
||
| $cmd = Utils\esc_cmd( $cmd_format, ...$cmd_args ); |
There was a problem hiding this comment.
Utils\esc_cmd( $cmd_format, ...$cmd_args ) uses argument unpacking (...), which is only available starting with PHP 5.6. This package explicitly supports PHP 5.4+ (see the server-command.php version check / feature tag), so this will cause a parse error on PHP 5.4/5.5. Use a PHP 5.4-compatible approach to pass a dynamic argument list (e.g., call_user_func_array() with the format string prepended to the args array).
| $cmd = Utils\esc_cmd( $cmd_format, ...$cmd_args ); | |
| $esc_cmd_args = $cmd_args; | |
| array_unshift( $esc_cmd_args, $cmd_format ); | |
| $cmd = call_user_func_array( 'WP_CLI\Utils\esc_cmd', $esc_cmd_args ); |
There was a problem hiding this comment.
@copilot This is incorrect. We require PHP 7.2+. Remove that check from server-command.php
There was a problem hiding this comment.
Done in 820f666. Removed the before_invoke PHP 5.4 version check from server-command.php and updated the @require-php-5.4 Behat feature tag to @require-php-7.2 to match the actual requirement.
| * @when before_wp_load | ||
| * | ||
| * @param array<string> $args Positional arguments passed through to the PHP binary. | ||
| * @param array{host: string, port: string, docroot?: string, config?: string} $assoc_args Associative arguments passed to the command. |
There was a problem hiding this comment.
The PHPDoc array-shape for $assoc_args doesn't match the actual values used in this method: port is an int by default, and both docroot and config can be false (see $defaults). With phpstan.neon.dist no longer suppressing missing types, this mismatch can lead to incorrect static analysis results. Update the PHPDoc to reflect the real types (e.g., port: int|string, docroot: string|false, config: string|false).
| * @param array{host: string, port: string, docroot?: string, config?: string} $assoc_args Associative arguments passed to the command. | |
| * @param array{host: string, port: int|string, docroot?: string|false, config?: string|false} $assoc_args Associative arguments passed to the command. |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Implementation Plan: Passthrough Arguments via
--Server_Command.phpto capture and handle passthrough arguments after--memory_limitvalue)--check in loop), simplify withstr_repeat+array_merge@paramannotations for$argsand$assoc_argsOriginal prompt
--? #59✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.