Skip to content

Allow null in docblocks to match existing code - #61679

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
miclf:patch-1
Sep 22, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
miclf:patch-1

Conversation

@miclf

@miclf miclf commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Just a quick fix of docblock tags that do not match actual code, thus causing static analysis tools to report errors.

There are 3 properties documented as non-nullable strings but that can be set to null in some cases: assetRoot, forcedRoot and forceScheme.

assetRoot can be set to null in the class constructor, because it defaults to null:

public function __construct(RouteCollectionInterface $routes, Request $request, $assetRoot = null)
{
    $this->routes = $routes;
    $this->assetRoot = $assetRoot;

    $this->setRequest($request);
}

forcedRoot can be set to null in forceRootUrl() (directly or via useOrigin()):

public function forceRootUrl($root)
{
    $this->forcedRoot = $root ? rtrim($root, '/') : null;

    $this->cachedRoot = null;
}

forceScheme, finally, can be set to null in the forceScheme() method:

public function forceScheme($scheme)
{
    $this->cachedScheme = null;

    $this->forceScheme = $scheme ? $scheme.'://' : null;
}

The code in this file does set these properties to `null` in some cases. As a result, static analysis tools report errors because the `@var` tags only allowed non-nullable strings.
@taylorotwell
taylorotwell merged commit 3b5d2d2 into laravel:13.x Sep 22, 2026
62 checks passed
@miclf
miclf deleted the patch-1 branch September 27, 2026 12:53
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