Add Larastan to enforce opinionated coding standards#31
Open
thinkstylestudio wants to merge 3 commits into
Open
Add Larastan to enforce opinionated coding standards#31thinkstylestudio wants to merge 3 commits into
thinkstylestudio wants to merge 3 commits into
Conversation
[Release 1]
Install larastan/larastan (successor to nunomaduro/larastan) with PHPStan level 6 and Larastan rules for model visibility, config types, and env usage. Fix existing type issues so analysis passes cleanly, add composer analyse script, Lando tooling, and a GitHub Actions workflow to enforce on PRs. Co-authored-by: Theron Smith <theron+github@thinkstylestudio.com>
| DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class, | ||
| // Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class, | ||
| Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class, | ||
| // Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class, |
Author
There was a problem hiding this comment.
Double check that these are not needed.
dpellenwood
approved these changes
May 22, 2026
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11
Summary
Adds Larastan (
larastan/larastan^3.0), the maintained successor to the abandonednunomaduro/larastanpackage, for static analysis of Laravel code.Configuration
phpstan.neon.distat level 6 with Larastan extension and opinionated rules:checkModelPropertiescheckModelMethodVisibilitycheckConfigTypesnoEnvCallsOutsideOfConfig,noModelMake, etc.)app/,config/,database/, androutes/Usage
composer analyse # or with Lando lando analyseCI
Adds a GitHub Actions workflow (
.github/workflows/phpstan.yml) that runscomposer analyseon pushes tomainand on pull requests.Code fixes
Resolved existing PHPStan issues so analysis passes without a baseline, including return types, model PHPDocs, Filament form component typing, and a commented-out
Spatie\LaravelData\Datacast (package not installed).