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

Update Action.php #27

Merged
merged 3 commits into from
Jun 11, 2022
Merged

Update Action.php #27

merged 3 commits into from
Jun 11, 2022

Conversation

maukoese
Copy link
Contributor

Return $this in the setRecord method to allow chaining.

Use case:

When skipping steps and using an action as the initial state, it makes sense to allow calling other actions;

E.g

        $payer = new MakePayment();
        $pledger = new MakePledge();

        return match (count($steps)) {
            1 => SelectCampaign::class,
            2 => $steps[0] === '2' ? PaymentWelcome::class : PledgeWelcome::class,
            3 => $steps[0] === '2' ? $payer->setRecord($this->record)->run() : $pledger->setRecord($this->record)->run(),
            default => Home::class
        };

Copy link
Member

@cybersai cybersai left a comment

Choose a reason for hiding this comment

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

Ideally, this changes the public API but since this method was meant to be used internally, we can allow this.
Again there will be no breaking changes I can foresee.

@papamarfo papamarfo merged commit 0f09486 into sparors:main Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants