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

[11.x] Remove unreachable code in AssertableJsonString #51943

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

seriquynh
Copy link
Contributor

This return $this statement is never touch because PHPUnit::fail() stands above it always throws an Exception .

@driesvints
Copy link
Member

Can you change the return docblock to void as well?

@seriquynh
Copy link
Contributor Author

@driesvints It's the assertMissingExact method and actually returns $this or fails.

<?php

public function assertMissingExact(array $data)
{
    // Domething something

    foreach (Arr::sortRecursive($data) as $key => $value) {
        $unexpected = $this->jsonSearchStrings($key, $value);

        if (! Str::contains($actual, $unexpected)) {
            return $this; // It returns $this here.
        }
    }

    // PHPUnit::fail()
}

@taylorotwell taylorotwell merged commit 639f729 into laravel:11.x Jun 28, 2024
25 checks passed
@seriquynh seriquynh deleted the remove-unreachable-code branch June 28, 2024 23:32
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