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

feat(AppFramework): extend range check to optional parameters #51116

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Feb 27, 2025

Summary

Now it also applies when a parameter is documented with a preceding ? or pending |null, but no further unionation is considered.

So previously the range check worked against parameters that were not nullable:

/**
  * @psalm-param int<1,500> $thisWasChecked
  * @psalm-param int<1,500>|null $thisWentUnderTheRadar
  * @psalm-param ?int<1,500> $thisWentUnderTheRadarAsWell
  * /

Now all cases are handled.

To keep in mind: when a parameter is passed in the query string without a value, it is considered an empty string, not a null value. To not risk breakage, we should refrain from backporting.

Checklist

@blizzz blizzz added this to the Nextcloud 32 milestone Feb 27, 2025
@blizzz blizzz requested review from nickvergessen, a team, ArtificialOwl, Altahrim and come-nc and removed request for a team February 27, 2025 18:17
@blizzz blizzz force-pushed the enh/noid/nullable-range branch from 0881c20 to 4552a7e Compare February 27, 2025 18:41
Now it also applies when a paramater is documtend with a pending |null,
but no further unionation is considered.

Signed-off-by: Arthur Schiwon <[email protected]>
@blizzz blizzz force-pushed the enh/noid/nullable-range branch from 4552a7e to 6594d7d Compare February 27, 2025 18:49
@blizzz blizzz merged commit 42d752f into master Mar 4, 2025
190 checks passed
@blizzz blizzz deleted the enh/noid/nullable-range branch March 4, 2025 13:23
@nickvergessen
Copy link
Member

Backport?

@blizzz
Copy link
Member Author

blizzz commented Mar 5, 2025

Backport?

From the description:

To keep in mind: when a parameter is passed in the query string without a value, it is considered an empty string, not a null value. To not risk breakage, we should refrain from backporting.

Do you have a different opinion on it?

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.

3 participants