Refactor to not have required parameters following an optional parameter#40303
Merged
phil-davis merged 1 commit intomasterfrom Aug 18, 2022
Merged
Refactor to not have required parameters following an optional parameter#40303phil-davis merged 1 commit intomasterfrom
phil-davis merged 1 commit intomasterfrom
Conversation
381de90 to
2284c7b
Compare
|
Kudos, SonarCloud Quality Gate passed! |
phil-davis
commented
Aug 18, 2022
| * @return Result | ||
| */ | ||
| private function getSharedWithMe($node = null, $includeTags, $requestedShareTypes, $stateFilter = 0) { | ||
| private function getSharedWithMe($node, $includeTags, $requestedShareTypes, $stateFilter = 0) { |
Contributor
Author
There was a problem hiding this comment.
The only caller of this method calls it with $node specified. The default value is never used, so I removed it.
phil-davis
commented
Aug 18, 2022
| * @since 10.0.10 | ||
| */ | ||
| public function __construct($message = "", $code, \Exception $previous = null) { | ||
| public function __construct($message = "", $code = 0, \Exception $previous = null) { |
Contributor
Author
There was a problem hiding this comment.
Other exceptions that extend this, specify a default of 0 for $code so I did the same here.
Member
|
Quoting the documentation:
If I understand it correctly, those parameters aren't optional any longer and must be provided. That's why the "damage" is pretty limited, otherwise we get an error with the argument count. |
jvillafanez
approved these changes
Aug 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Description
All required parameters should be listed first in PHP functions. Adjust the code to meet this rule.
I noticed this when running PHPstan in a different environment, and it told me about these existing invalid/not-useful parameter lists.
How Has This Been Tested?
CI
Types of changes
Checklist: