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

variableParameters are set to string #37

Open
nime11 opened this issue Sep 30, 2022 · 1 comment
Open

variableParameters are set to string #37

nime11 opened this issue Sep 30, 2022 · 1 comment

Comments

@nime11
Copy link

nime11 commented Sep 30, 2022

Hi,
on ProductRequest.php you have one bug on function setVariableParameters it set that you need to send string to a function, but if you want to send multiple parameter you need to send array.
WRONG:
public function setVariableParameters(string ...$variableParameters): void { $this->variableParameters = $variableParameters; }
RIGHT:
public function setVariableParameters(array...$variableParameters): void { $this->variableParameters = $variableParameters; }

@MichalSalon
Copy link

The code is written correctly, as the input is variadic (notice the ... before $variableParameters).

If you know the parameters and they don't change, you can hard code them

$product->setVariableParameters('one', 'two', 'three');

Most often you get an array from entity or somewhere, in that case, this is the way to use the function

$myParameters = ['one', 'two', 'three'];
$product->setVariableParameters(...$myParameters);

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

No branches or pull requests

2 participants