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

[10.x] Update Facade::$app to nullable #50260

Merged
merged 1 commit into from
Feb 26, 2024
Merged

[10.x] Update Facade::$app to nullable #50260

merged 1 commit into from
Feb 26, 2024

Conversation

villfa
Copy link
Contributor

@villfa villfa commented Feb 26, 2024

Facade::$app can be null.
There are already some nullability checks within the same class (see swap() or resolveFacadeInstance()).

Making it explicit in the PHP blocks allows us to avoid errors with static analysis tools like PHPStan:

Parameter #1 $app of static method Illuminate\Support\Facades\Facade::setFacadeApplication() expects Illuminate\Contracts\Foundation\Application, null given.

@taylorotwell taylorotwell merged commit b8b71e0 into laravel:10.x Feb 26, 2024
26 checks passed
@villfa villfa deleted the patch-2 branch February 26, 2024 17:10
@jose123v
Copy link
Contributor

jose123v commented Feb 28, 2024

@taylorotwell this breaks PHPStan and other analysis tools on laravel 10.x,
on 8.x, 9.x, 11.x works because these don't have this change

Error: Cannot call method make() on Illuminate\Contracts\Foundation\Application|null.
 ------ --------------------------------------------------- 
  53     Cannot call method make() on                       
         Illuminate\Contracts\Foundation\Application|null.  
 ------ --------------------------------------------------- 

CC: @driesvints

@driesvints
Copy link
Member

@jose123v can you share a full stack trace?

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.

4 participants