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

Change all MasterRequest calls to MainRequest #13251

Merged
merged 3 commits into from
Jan 11, 2022

Conversation

Roshyo
Copy link
Contributor

@Roshyo Roshyo commented Oct 26, 2021

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? removing deprecations
Related tickets
License MIT

For now, it should accept both until Symfony <5.3 support is dropped

@Roshyo Roshyo requested a review from a team as a code owner October 26, 2021 14:55
@probot-autolabeler probot-autolabeler bot added Admin AdminBundle related issues and PRs. API APIs related issues and PRs. Shop ShopBundle related issues and PRs. labels Oct 26, 2021
if (\method_exists($event, 'isMainRequest')) {
$isMainRequest = $event->isMainRequest();
} else {
$isMainRequest = $event->isMasterRequest();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be good to add deprectation warnings to these clauses. Perhaps using:
https://github.com/symfony/deprecation-contracts/blob/main/function.php

Copy link
Contributor Author

@Roshyo Roshyo Oct 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean ? The idea here is just to have a version that will work on both Symfony 4.x and 5.3+ without deprecation warning. Then when dropping <5.3 support, only the mainRequest part will stay.

But I don't see the point in throwing deprecation notice when the goal is to hide them

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecation warnings are intended on classes or methods, not inside methods. Also it's well known1 that the hundreds of deprecations being thrown these days because of this master => main rename is slowing down performance so please don't add one more :(

Footnotes

  1. https://stackoverflow.com/a/1869185/4819591

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, well the point is to have some sort of pointer that this needs to be removed at some point, in the current situation it is not documented and will continue to work forever. Maybe it's an idea to add a comment or something then?
This may be a wild idea, but there is a lot of duplication of this logic now, perhaps introduce a separate class for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought of a separate class, like RequestProvider or something. Because the logic is often the same, but with some small differences. But it seems way too much for this.

But I agree with you that we need to store somewhere to get rid of this once we only support 5.3+

Perhaps in some .md file ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're suggesting to merge the current state first and then have it refactored into the new component in a different PR? Why exactly?
If it's too much work, perhaps I could lend a helping hand. 💪

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be my proposition.

First of all, because creating a new component seems more than just one folder. Sylius is hosting them as separate packages.

Second thing would be that right now, this PR is really easy to read/understand. And I have the small hope that this way, it will get approved/merged before next release 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid points, unfortunately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey folks, thanks for contribution and discussion about it. Sample trait could be created behind the https://github.com/SyliusLabs umbrella, but it may be too much. The problem is, that 1.11 branch has been already split. I'm not sure, it will land in Sylius v1.11.X series.

Copy link
Member

@lchrusciel lchrusciel Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we can add note to: #13274 or separate issue, as Youri mentioned

@vvasiloi
Copy link
Contributor

vvasiloi commented Jan 3, 2022

I was almost sure this was already merged...

Edit: I also triggered a re-run of all checks, because one failed with a segmentation fault.

@Roshyo
Copy link
Contributor Author

Roshyo commented Jan 4, 2022

Yeah, me too 🤔 IDK what happened

@vvasiloi
Copy link
Contributor

vvasiloi commented Jan 4, 2022

Looks like it didn't re-run the jobs...
Can you rebase and push, @Roshyo?

@4c0n
Copy link
Contributor

4c0n commented Jan 4, 2022

So in the end there is no mention of having to remove the if statements at some point in the future anywhere?
I don't want to block merging this PR, but I do feel we need at least something as a reminder that this requires work when isMasterRequest() is finally fased out.

Could be a github issue or PR as well as far as I'm concerned.

@Roshyo
Copy link
Contributor Author

Roshyo commented Jan 4, 2022

I'm ok to write it somewhere, but I can't find any md file that would fit. Perhaps an issue is the way to go 🤔

if (\method_exists($event, 'isMainRequest')) {
$isMainRequest = $event->isMainRequest();
} else {
$isMainRequest = $event->isMasterRequest();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey folks, thanks for contribution and discussion about it. Sample trait could be created behind the https://github.com/SyliusLabs umbrella, but it may be too much. The problem is, that 1.11 branch has been already split. I'm not sure, it will land in Sylius v1.11.X series.

if (\method_exists($event, 'isMainRequest')) {
$isMainRequest = $event->isMainRequest();
} else {
$isMainRequest = $event->isMasterRequest();
Copy link
Member

@lchrusciel lchrusciel Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we can add note to: #13274 or separate issue, as Youri mentioned

Copy link
Member

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant, that we should place this comment above all occurrence of this ACL ifs. But thats a minor stuff. The plan will be as follows:

  1. Merge it to 1.11, to get rid of deprecation message
  2. Bump Symfony requirements to Sf ^5.4 on master
  3. Remove this ACL from the master
    At the end, trait would live with us too short, to consider it as separate package in my opinion.

@lchrusciel lchrusciel changed the base branch from master to 1.11 January 5, 2022 14:34
@lchrusciel
Copy link
Member

The base of this pull-request was changed, you need fetch and reset your local branch
if you want to add new commits to this pull request. Reset before you pull, else commits
may become messed-up.

Unless you added new commits (to this branch) locally that you did not push yet,
execute git fetch origin && git reset "main-request-change" to update your local branch.

Feel free to ask for assistance when you get stuck 👍

@lchrusciel lchrusciel merged commit d016099 into Sylius:1.11 Jan 11, 2022
@lchrusciel
Copy link
Member

Thanks, Stephane! 🥇

@Roshyo Roshyo mentioned this pull request Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs. API APIs related issues and PRs. Shop ShopBundle related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants