-
Notifications
You must be signed in to change notification settings - Fork 28
Removing method default parameter value should generate MAJOR level entry #83
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
Comments
If I'm not mistaken, this should be taken care by V002, V010 and V011. As you've observed, the removal of a default parameter is similar to the addition of a new parameter to the function/method signature. I believe this case is already taken care of in https://github.com/tomzx/php-semver-checker/blob/master/src/PHPSemVerChecker/Comparator/Signature.php#L22:L27. If that is not the case, could you please provide a test case where V002/V010/V011 is not triggered? |
Then I'm definitely missing something. Admittedly I did use my project's composer.json & composer update to install the package into my project, against your recommendation, but I'm not sure that is the reason behind the problem: When I remove default params to try and trigger the V010 & V011, I only get V023, V024 & V060 triggered. |
You are correct, it appears there is a bug if the previous/after function are of the same length but their optional parameters have changed. This however points out there's a couple of issues with the current verification rules, namely that we might have to create a set for the addition of new parameters with default or the conversion of a required parameter into an optional parameter (aka parameter with default value) (which is a minor change), the removal of a parameter's default value (which is a major change as you pointed out). Supporting this change will be more involved than what I expected however, so I'll have to look into it a little more before anything can be fixed. Thanks for reporting this issue. |
No problem, glad I could help. Do you have any timetable for this? I'm looking forward to using your library, as soon as the issue is fixed. |
Sadly, the whole function/method signature comparison needs a major overhaul. As this project is not overly active, I cannot provide you with any timetable. However, I'll try to allocate myself some time to work on this issue this month. Hopefully it can be done within the month (with a bunch of new features/fixes). |
…ature: - Parameter added/removed - Parameter typing added/removed - Parameter default added/removed - Parameter default value changed Major refactoring of the operations so that they only contain their code and reason, moving everything else to the *OperatorUnary/*OperatorDelta classes. Major refactoring of the function analyzer and class method analyzer tests to test all visibilities and type (class/interface/trait). [#83] Removing method default parameter value should generate MAJOR level entry
I've been able to finish most of the bulk of the work (@c896df0b71b37d58891bddfb977a15e86fe1f392), however I believe there are still issues left (which will be discovered in time). Note that rules V072, V094-V096, V078 and V112-V114 have been assigned to this. Give it a try and let me know if you have any issues. |
Removing method default parameter value should generate MAJOR level entry. Because if you remove default value, you are changing the signature of the method, effectively breaking backwards compatibility. Before the change, you were able to call the method without providing said parameter and after the change, you have to provide it. Am I missing anything?
The text was updated successfully, but these errors were encountered: