Skip to content

[9.x] Update array generic types to match laravel/laravel skeleton implementations #45795

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

Merged

Conversation

shauno
Copy link
Contributor

@shauno shauno commented Jan 25, 2023

When using PHPStan Strict Rules in conjunction with Larastan, there are a few errors with a default install of 9.x. Most of these can easily be fixed in the app code if you want, but some of the default implementations have docblock typehints that are incompatible with the vendor classes they extend. There is no nice way to ignore those in PHPStan other than creating stubs.

An example:

------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Line   Http/Kernel.php
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  16     PHPDoc type array<int, string> of property App\Http\Kernel::$middleware is not the same as PHPDoc type array of overridden property Illuminate\Foundation\Http\Kernel::$middleware.
         💡 You can fix 3rd party PHPDoc types with stub files:
            https://phpstan.org/user-guide/stub-files
            This error can be turned off by setting
            reportMaybesInPropertyPhpDocTypes: false in your phpstan.neon.

I did see that @nunomaduro already made some improvements to the skeleton code in this PR, so it stands to reason the actually classes being extended should be updated too?

I have only updated the properties that are actually overwritten by the app in a default install

@shauno shauno changed the title Update array generic types to match laravel/laravel skeleton implementations [9.x] Update array generic types to match laravel/laravel skeleton implementations Jan 25, 2023
@driesvints driesvints requested a review from nunomaduro January 25, 2023 12:19
@taylorotwell taylorotwell merged commit b685a7a into laravel:9.x Jan 25, 2023
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