Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support int|float #2

Merged
merged 3 commits into from
Sep 20, 2024
Merged

support int|float #2

merged 3 commits into from
Sep 20, 2024

Conversation

divinity76
Copy link
Member

@divinity76 divinity76 commented Sep 19, 2024

it's annoying when going through old code with lots of unquoted arguments, and just add quotes to them all, and then being met with "InvalidArgumentException: int"

This has happened to me several times in the past, and it very nearly happened again here with $ssl_enabled: https://github.com/hestiacp/hestiacp/pull/4569/files#diff-55ab675d04a6f347147d37a4232b891f10f2c91b05f4126f16d93e75139b1c0cR87

"--firstname=" . quoteshellarg($options["prestashop_account_first_name"]),
"--lastname=" . quoteshellarg($options["prestashop_account_last_name"]),
"--password=" . quoteshellarg($options["prestashop_account_password"]),
"--email=" . quoteshellarg($options["prestashop_account_email"]),
"--domain=" . quoteshellarg($this->domain),
"--ssl=" . (int) $ssl_enabled,

It's better to just support it.

Btw if we don't care about PHP7.4 compatibility, it would be better to use

function quoteshellarg(string|float|int $arg): string

@jaapmarcus
Copy link
Member

Btw if we don't care about PHP7.4 compatibility, it would be better to use

Fine for me...

@divinity76
Copy link
Member Author

@jaapmarcus done.

@jaapmarcus jaapmarcus merged commit 3499670 into main Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants