Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ad2a952
larastan/phpstan
jasonvarga Jul 2, 2026
614978f
Fix PHPStan new.static errors with @phpstan-consistent-constructor
jasonvarga Jul 2, 2026
6c01c4c
Fix PHPStan method.staticCall errors with explicit facade return types
jasonvarga Jul 2, 2026
f93c6b9
Fix PHPStan method.notFound errors with @mixin/@var annotations
jasonvarga Jul 2, 2026
2a139c8
Ignore PHPStan errors from optional spatie/laravel-ignition integration
jasonvarga Jul 2, 2026
b3d0e7f
Ignore PHPStan errors from optional composer/composer integration
jasonvarga Jul 2, 2026
e441ab7
Ignore PHPStan errors from optional barryvdh/laravel-debugbar integra…
jasonvarga Jul 2, 2026
45f6454
Remove dead UserCollection::extract() method
jasonvarga Jul 2, 2026
4b286d0
Remove dead Statamic\View\Store container binding
jasonvarga Jul 2, 2026
d0227ea
Remove dead Statamic\Taxonomies\TermTracker class
jasonvarga Jul 2, 2026
061a4a0
Remove unreachable Route branch from AddRequestMessage::label()
jasonvarga Jul 2, 2026
b2c927c
Fix PHPStan method.void errors with stale @return void docblocks
jasonvarga Jul 2, 2026
57bde3b
Fix PHPStan method.void errors by dropping pointless return
jasonvarga Jul 2, 2026
d2baef1
Fix PHPStan method.void/function.void errors in early-exit guard clauses
jasonvarga Jul 2, 2026
56c2803
Fix PHPStan staticProperty.notFound errors by declaring base properties
jasonvarga Jul 2, 2026
c5d8f02
2 spacse
jasonvarga Jul 2, 2026
6851d63
rename to phpstan.dist.neon
jasonvarga Jul 2, 2026
d9afe77
workflow
jasonvarga Jul 2, 2026
3e8f2de
rename to match "CodeQL / Analyze" check name
jasonvarga Jul 2, 2026
42e56c8
Fix PHPStan errors with stale docblocks and undeclared override points
jasonvarga Jul 2, 2026
5249e28
Ignore PHPStan error from optional spatie/laravel-ignition ddd() helper
jasonvarga Jul 2, 2026
3ce13aa
Simplify dead dispatchNow fallback in AssetsGeneratePresets
jasonvarga Jul 2, 2026
fd839da
Ignore PHPStan error from Carbon's self::this() macro scope rebinding
jasonvarga Jul 2, 2026
4789b98
Clean up CollectionsServiceProvider: remove dead macros, use public API
jasonvarga Jul 2, 2026
9908411
Use getEngine() instead of protected $engine in View::withoutExtracti…
jasonvarga Jul 2, 2026
ce7b747
Add default case to repositoryHasBeenMigrated() switch
jasonvarga Jul 2, 2026
869e65b
Throw Flysystem's standard exceptions from GuzzleAdapter's stub methods
jasonvarga Jul 2, 2026
9b45580
Add PHPStan baseline in .phpstan/ to keep the config green as debt ac…
jasonvarga Jul 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.travis.yml export-ignore
CONTRIBUTING.md export-ignore
jest.config.js export-ignore
phpstan.dist.neon export-ignore
phpunit.bat export-ignore
phpunit.xml.dist export-ignore
SECURITY.md export-ignore
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: PHPStan

on:
pull_request:

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
phpstan:
name: Analyze
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
src/**
composer.json
phpstan.dist.neon
.phpstan/**
.github/workflows/phpstan.yml

- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
if: steps.changed-files.outputs.any_modified == 'true'
with:
php-version: 8.5
coverage: none

- name: Install dependencies
uses: nick-invision/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
if: steps.changed-files.outputs.any_modified == 'true'
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction

- name: Run PHPStan
if: steps.changed-files.outputs.any_modified == 'true'
run: vendor/bin/phpstan analyse --memory-limit=2G
277 changes: 277 additions & 0 deletions .phpstan/baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
parameters:
ignoreErrors:
-
message: '#^Method Statamic\\Auth\\Eloquent\\User\:\:mergePreferences\(\) should return \$this\(Statamic\\Auth\\Eloquent\\User\) but return statement is missing\.$#'
identifier: return.missing
count: 1
path: ../src/Auth/Eloquent/User.php

-
message: '#^Method Statamic\\Auth\\Eloquent\\User\:\:setPreferences\(\) should return \$this\(Statamic\\Auth\\Eloquent\\User\) but return statement is missing\.$#'
identifier: return.missing
count: 1
path: ../src/Auth/Eloquent/User.php

-
message: '#^Method Statamic\\Auth\\User\:\:getAuthIdentifierName\(\) should return string but return statement is missing\.$#'
identifier: return.missing
count: 1
path: ../src/Auth/User.php

-
message: '#^Access to an undefined property Statamic\\Auth\\UserRepository\:\:\$roleRepository\.$#'
identifier: property.notFound
count: 1
path: ../src/Auth/UserRepository.php

-
message: '#^Access to an undefined property Statamic\\Auth\\UserRepository\:\:\$userGroupRepository\.$#'
identifier: property.notFound
count: 1
path: ../src/Auth/UserRepository.php

-
message: '#^Call to an undefined method Statamic\\Auth\\UserRepository\:\:query\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/Auth/UserRepository.php

-
message: '#^Unknown parameter \$editing in call to static method Statamic\\Facades\\CP\\Nav\:\:build\(\)\.$#'
identifier: argument.unknown
count: 1
path: ../src/CP/Navigation/NavTransformer.php

-
message: '#^Unknown parameter \$preferences in call to static method Statamic\\Facades\\CP\\Nav\:\:build\(\)\.$#'
identifier: argument.unknown
count: 1
path: ../src/CP/Navigation/NavTransformer.php

-
message: '#^Unsafe usage of new static\(\)\.$#'
identifier: new.static
count: 1
path: ../src/Events/Event.php

-
message: '#^Unsafe usage of new static\(\)\.$#'
identifier: new.static
count: 2
path: ../src/Events/Subscriber.php

-
message: '#^Called ''env'' outside of the config directory which returns null when the config is cached, use ''config''\.$#'
identifier: larastan.noEnvCallsOutsideOfConfig
count: 1
path: ../src/Facades/Endpoint/Parse.php

-
message: '#^Method Illuminate\\Contracts\\Validation\\DataAwareRule@anonymous/Fieldtypes/Bard\.php\:898\:\:setData\(\) should return \$this\(Illuminate\\Contracts\\Validation\\DataAwareRule@anonymous/Fieldtypes/Bard\.php\:898\) but return statement is missing\.$#'
identifier: return.missing
count: 1
path: ../src/Fieldtypes/Bard.php

-
message: '#^Access to an undefined property Statamic\\Filesystem\\AbstractAdapter\:\:\$filesystem\.$#'
identifier: property.notFound
count: 13
path: ../src/Filesystem/AbstractAdapter.php

-
message: '#^Call to an undefined method Statamic\\Filesystem\\AbstractAdapter\:\:copyDirectory\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Filesystem/AbstractAdapter.php

-
message: '#^Call to an undefined method Statamic\\Filesystem\\AbstractAdapter\:\:getFiles\(\)\.$#'
identifier: method.notFound
count: 3
path: ../src/Filesystem/AbstractAdapter.php

-
message: '#^Call to an undefined method Statamic\\Filesystem\\AbstractAdapter\:\:getFolders\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/Filesystem/AbstractAdapter.php

-
message: '#^Call to an undefined method Statamic\\Filesystem\\AbstractAdapter\:\:moveDirectory\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Filesystem/AbstractAdapter.php

-
message: '#^Result of method Statamic\\Forms\\Form\:\:save\(\) \(void\) is used\.$#'
identifier: method.void
count: 1
path: ../src/Forms/Form.php

-
message: '#^Result of method Statamic\\Forms\\Submission\:\:save\(\) \(void\) is used\.$#'
identifier: method.void
count: 1
path: ../src/Forms/Submission.php

-
message: '#^Access to an undefined property Statamic\\Http\\Controllers\\API\\ApiController\:\:\$params\.$#'
identifier: property.notFound
count: 1
path: ../src/Http/Controllers/API/ApiController.php

-
message: '#^Unknown parameter \$editing in call to static method Statamic\\Facades\\CP\\Nav\:\:build\(\)\.$#'
identifier: argument.unknown
count: 1
path: ../src/Http/Controllers/CP/Preferences/Nav/DefaultNavController.php

-
message: '#^Unknown parameter \$preferences in call to static method Statamic\\Facades\\CP\\Nav\:\:build\(\)\.$#'
identifier: argument.unknown
count: 1
path: ../src/Http/Controllers/CP/Preferences/Nav/DefaultNavController.php

-
message: '#^Unknown parameter \$editing in call to static method Statamic\\Facades\\CP\\Nav\:\:build\(\)\.$#'
identifier: argument.unknown
count: 1
path: ../src/Http/Controllers/CP/Preferences/Nav/RoleNavController.php

-
message: '#^Unknown parameter \$preferences in call to static method Statamic\\Facades\\CP\\Nav\:\:build\(\)\.$#'
identifier: argument.unknown
count: 1
path: ../src/Http/Controllers/CP/Preferences/Nav/RoleNavController.php

-
message: '#^Access to an undefined property Statamic\\Imaging\\GlideManager\:\:\$cachePathPrefix\.$#'
identifier: property.notFound
count: 1
path: ../src/Imaging/GlideManager.php

-
message: '#^Access to an undefined property Statamic\\Imaging\\GlideManager\:\:\$sourcePathPrefix\.$#'
identifier: property.notFound
count: 1
path: ../src/Imaging/GlideManager.php

-
message: '#^Call to an undefined method Statamic\\Imaging\\GlideManager\:\:getAllParams\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Imaging/GlideManager.php

-
message: '#^Call to an undefined method Statamic\\Imaging\\GlideManager\:\:getSourcePath\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Imaging/GlideManager.php

-
message: '#^Called ''env'' outside of the config directory which returns null when the config is cached, use ''config''\.$#'
identifier: larastan.noEnvCallsOutsideOfConfig
count: 1
path: ../src/Marketplace/Client.php

-
message: '#^Call to an undefined method Statamic\\Providers\\AppServiceProvider\:\:sendElevatedSessionVerificationCode\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Providers/AppServiceProvider.php

-
message: '#^Access to an undefined property Statamic\\Providers\\EventServiceProvider\:\:\$listeners\.$#'
identifier: property.notFound
count: 2
path: ../src/Providers/EventServiceProvider.php

-
message: '#^Call to an undefined method Statamic\\Stache\\Indexes\\Index\:\:getItemValue\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Stache/Indexes/Index.php

-
message: '#^Access to an undefined property Statamic\\Stache\\Stores\\AggregateStore\:\:\$childStore\.$#'
identifier: property.notFound
count: 1
path: ../src/Stache/Stores/AggregateStore.php

-
message: '#^Call to an undefined method Statamic\\Stache\\Stores\\Store\:\:cacheItem\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/Stache/Stores/Store.php

-
message: '#^Call to an undefined method Statamic\\Stache\\Stores\\Store\:\:forgetItem\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/Stache/Stores/Store.php

-
message: '#^Call to an undefined method Statamic\\Stache\\Stores\\Store\:\:getKeyFromPath\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Stache/Stores/Store.php

-
message: '#^Call to an undefined method Statamic\\Stache\\Stores\\Store\:\:makeItemFromFile\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/Stache/Stores/Store.php

-
message: '#^Method Statamic\\StaticCaching\\Cachers\\NullCacher\:\:getCachedPage\(\) should return Statamic\\StaticCaching\\Page but return statement is missing\.$#'
identifier: return.missing
count: 1
path: ../src/StaticCaching/Cachers/NullCacher.php

-
message: '#^Call to an undefined method Statamic\\StaticCaching\\NoCache\\Region\:\:key\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/StaticCaching/NoCache/Region.php

-
message: '#^Access to an undefined property Statamic\\Structures\\StructureRepository\:\:\$store\.$#'
identifier: property.notFound
count: 2
path: ../src/Structures/StructureRepository.php

-
message: '#^Call to an undefined method Statamic\\Support\\Manager\:\:createNullDriver\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Support/Manager.php

-
message: '#^Access to an undefined property Statamic\\Testing\\AddonTestCase\:\:\$fakeStacheDirectory\.$#'
identifier: property.notFound
count: 1
path: ../src/Testing/AddonTestCase.php

-
message: '#^Call to an undefined method Statamic\\Testing\\AddonTestCase\:\:deleteFakeStacheDirectory\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Testing/AddonTestCase.php

-
message: '#^Call to an undefined method Statamic\\Testing\\AddonTestCase\:\:preventSavingStacheItemsToDisk\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/Testing/AddonTestCase.php

-
message: '#^Call to an undefined method Statamic\\View\\Scaffolding\\Emitters\\AbstractSourceEmitter\:\:getCountedVariable\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/View/Scaffolding/Emitters/AbstractSourceEmitter.php

-
message: '#^Call to an undefined method Statamic\\View\\Scaffolding\\Emitters\\AbstractSourceEmitter\:\:releaseCountedVariable\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/View/Scaffolding/Emitters/AbstractSourceEmitter.php
Loading
Loading