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

Print original params in Carbon\Traits\Units::addUnit error message #2677

Merged

Conversation

costasovo
Copy link
Contributor

Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter but will instead provide the current value.

The parameter $unit was changed in previous lines. So the exception message contains the changed value.

I assume that it is nicer to print the original values so that the user of the library knows which value caused the issue.

This PR preserves the original arguments in a variable to be eventually used in the error message.

Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value.
The parameter "$unit" was changed in previous lines. So the exception message contains the changed value.
This commit preserves the original arguments in variable to be eventually used in the error message.
@kylekatarnls kylekatarnls added this to the 2.63.0 milestone Oct 6, 2022
@kylekatarnls kylekatarnls merged commit 5477095 into briannesbitt:master Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants