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

[5.4] Return the used traits from setUpTraits #19486

Merged
merged 1 commit into from
Jun 6, 2017
Merged

[5.4] Return the used traits from setUpTraits #19486

merged 1 commit into from
Jun 6, 2017

Conversation

Lidbetter
Copy link
Contributor

@Lidbetter Lidbetter commented Jun 5, 2017

Allows for the developer to add their own traits and actions during the setup phase without having to call: $uses = array_flip(class_uses_recursive(static::class)); in the subclass.

Example usage before:

    protected function setUpTraits()
    {
        parent::setUpTraits();
        $uses = array_flip(class_uses_recursive(static::class));

        if(isset($uses[MyGreatTrait::class])) {
            $this->runMyUsefulThing();
        }
    }

Example usage with change from this pr:

    protected function setUpTraits()
    {
        $uses = parent::setUpTraits();

        if(isset($uses[MyGreatTrait::class])) {
            $this->runMyUsefulThing();
        }

        return $uses;
    }

@Lidbetter Lidbetter changed the title Return the used traits from setUpTraits [5.4] Return the used traits from setUpTraits Jun 5, 2017
@taylorotwell taylorotwell merged commit 4586bb7 into laravel:5.4 Jun 6, 2017
crynobone added a commit to orchestral/testbench that referenced this pull request Jun 6, 2017
From laravel/framework#19486

Signed-off-by: crynobone <crynobone@gmail.com>
@mfn
Copy link
Contributor

mfn commented Jun 7, 2017

Great @Lidbetter just want I was thinking about the other day, thx!

springer12 added a commit to springer12/laravel-testbench that referenced this pull request May 9, 2020
From laravel/framework#19486

Signed-off-by: crynobone <crynobone@gmail.com>
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