Skip to content

Conversation

AhmedAlaa4611
Copy link
Contributor

Description

In PR #56621, the implementation was updated to use a return with a ternary:

return json_validate($content)
    ? $this->ddJson($key)
    : dd($content);

Since both dd() and ddJson() terminate the script, the return here is effectively unreachable. This makes the code look like it returns a value, when in reality it never does.

A clearer approach, and one that aligns with the original implementation’s style (just without the function_exists guard), would be:

if (json_validate($content)) {
    $this->ddJson($key);
}

dd($content);

This keeps the semantics consistent with the @return never contract and with other dd* helpers in the framework.

@taylorotwell taylorotwell merged commit 2d80095 into laravel:12.x Aug 26, 2025
62 checks passed
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.

2 participants