Allow true return annotation in upgrade.php function#371
Open
daniil-berg wants to merge 1 commit intomoodlehq:mainfrom
Open
Allow true return annotation in upgrade.php function#371daniil-berg wants to merge 1 commit intomoodlehq:mainfrom
true return annotation in upgrade.php function#371daniil-berg wants to merge 1 commit intomoodlehq:mainfrom
Conversation
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.
Technically, the
xmldb_..._upgradefunction indb/upgrade.phpalways returnstrue. Since PHP 8.2 you can actually annotate it accordingly. I discovered that doing so causes this weird warning from thesavepointschecker:This PR just extends the function RegEx to also match a
truereturn type annotation, not just one withbool. (Also being more lenient with the whitespace here would not hurt since this is not a style checker.)It seems
tests/check_upgrade_savepoints.batsdoes the testing and there already is thetests/fixtures/check_upgrade_savepoints/returning_bool.patchfixture forboolreturn types. But I have never seen this type of testing setup before, so I am not sure how best to add a corresponding test case.If you tell me how I should go about it, I am sure adding a test case for this should not be too difficult.