diff --git a/.gitattributes b/.gitattributes index 887616f4e4f..bbb245f903e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 00000000000..302695972da --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -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 diff --git a/.phpstan/baseline.neon b/.phpstan/baseline.neon new file mode 100644 index 00000000000..527438b53cd --- /dev/null +++ b/.phpstan/baseline.neon @@ -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 diff --git a/.phpstan/stubs/debugbar.php b/.phpstan/stubs/debugbar.php new file mode 100644 index 00000000000..da2420b0efe --- /dev/null +++ b/.phpstan/stubs/debugbar.php @@ -0,0 +1,80 @@ +name = $name; + } + + public function reset(): void + { + // + } + + public function setData(array $data): void + { + // + } + + public function collect(): array + { + return []; + } + + public function getName(): string + { + return $this->name; + } + + public function getWidgets(): array + { + return []; + } +} diff --git a/composer.json b/composer.json index 557e1ae5e47..d84c9a1e0b2 100644 --- a/composer.json +++ b/composer.json @@ -45,11 +45,13 @@ "doctrine/dbal": "^3.6", "fakerphp/faker": "~1.10", "google/cloud-translate": "^1.6", + "larastan/larastan": "^3.10", "laravel/pao": "^1.1", "laravel/pint": "1.16.0", "laravel/socialite": "^5.28", "mockery/mockery": "^1.6.10", "orchestra/testbench": "^10.8 || ^11.0", + "phpstan/phpstan": "^2.2", "phpunit/phpunit": "^12.5.23", "spatie/laravel-ray": "^1.43.6" }, diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 00000000000..f15f7c292ef --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,63 @@ +includes: + - vendor/larastan/larastan/extension.neon + - .phpstan/baseline.neon + +parameters: + level: 0 + paths: + - src + + # Symbol-only stubs for optional runtime integrations that this package + # never requires as real dependencies (see .phpstan/stubs/debugbar.php). + scanFiles: + - .phpstan/stubs/debugbar.php + + ignoreErrors: + - + identifier: class.notFound + message: '#^(Class|Instantiated class) Spatie\\LaravelIgnition\\Exceptions\\(ViewException|ViewExceptionWithSolution) not found\.$#' + path: src/View/Antlers/Language/Runtime/RuntimeParser.php + + # composer/composer is an optional runtime integration (composer update hooks), not a real dependency. + - + identifier: class.notFound + message: '#^Parameter \$event of method Statamic\\Console\\Composer\\Scripts::preUpdateCmd\(\) has invalid type Composer\\Script\\Event\.$#' + path: src/Console/Composer/Scripts.php + + # barryvdh/laravel-debugbar is an optional runtime integration, guarded by class_exists()/isEnabled() checks. + - + identifier: class.notFound + message: '#^Caught class DebugBar\\DebugBarException not found\.$#' + path: src/Forms/Tags.php + - + identifier: function.notFound + message: '#^Function debug not found\.$#' + path: src/Modifiers/CoreModifiers.php + + # spatie/laravel-ignition is an optional runtime integration; ddd() is one of its helpers. + - + identifier: function.notFound + message: '#^Function ddd not found\.$#' + path: src/Modifiers/CoreModifiers.php + + # self::this() inside the Carbon::macro() closure resolves to Carbon\Traits\Mixin::this(), + # a protected static method Carbon rebinds into scope for macros registered via Mixin - + # see vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php. PHPStan can't follow the + # static-closure scope rebinding, so it thinks this() is being called on this class. + - + identifier: staticMethod.notFound + message: '#^Call to an undefined static method Statamic\\Providers\\AppServiceProvider::this\(\)\.$#' + path: src/Providers/AppServiceProvider.php + + # keyByWithKey() is a public Collection macro kept for third-party/addon backward + # compatibility even though Statamic's own code no longer calls it, so its use of + # Collection's protected valueRetriever()/$items internals is left as-is rather than + # rewritten to public equivalents. + - + identifier: method.protected + message: '#^Call to protected method valueRetriever\(\) of class Illuminate\\Support\\Collection(<.*>)?\.$#' + path: src/Providers/CollectionsServiceProvider.php + - + identifier: property.protected + message: '#^Access to protected property Illuminate\\Support\\Collection::\$items\.$#' + path: src/Providers/CollectionsServiceProvider.php diff --git a/src/Assets/AssetContainer.php b/src/Assets/AssetContainer.php index 35f5d4ecb51..d4bbbee5db6 100644 --- a/src/Assets/AssetContainer.php +++ b/src/Assets/AssetContainer.php @@ -254,7 +254,7 @@ public function saveQuietly() /** * Save the container. * - * @return void + * @return $this|false */ public function save() { @@ -303,7 +303,7 @@ public function deleteQuietly() /** * Delete the container. * - * @return void + * @return bool */ public function delete() { diff --git a/src/Assets/AssetFolder.php b/src/Assets/AssetFolder.php index e190d9f1b13..8b5133f4e1e 100644 --- a/src/Assets/AssetFolder.php +++ b/src/Assets/AssetFolder.php @@ -14,6 +14,9 @@ use Statamic\Support\Str; use Statamic\Support\Traits\FluentlyGetsAndSets; +/** + * @phpstan-consistent-constructor + */ class AssetFolder implements Arrayable, ContainsQueryableValues, Contract { use FluentlyGetsAndSets; diff --git a/src/Assets/AssetUploader.php b/src/Assets/AssetUploader.php index e9191292730..a2ae1576932 100644 --- a/src/Assets/AssetUploader.php +++ b/src/Assets/AssetUploader.php @@ -9,6 +9,9 @@ use Statamic\Support\Str; use Symfony\Component\HttpFoundation\File\UploadedFile; +/** + * @phpstan-consistent-constructor + */ class AssetUploader extends Uploader { private $asset; diff --git a/src/Assets/FileUploader.php b/src/Assets/FileUploader.php index 58a1e3f086b..97461cb9d64 100644 --- a/src/Assets/FileUploader.php +++ b/src/Assets/FileUploader.php @@ -6,6 +6,9 @@ use Statamic\Facades\AssetContainer; use Symfony\Component\HttpFoundation\File\UploadedFile; +/** + * @phpstan-consistent-constructor + */ class FileUploader extends Uploader { protected $container; diff --git a/src/Auth/CorePermissions.php b/src/Auth/CorePermissions.php index 0fec10cb629..d0d3eeb125d 100644 --- a/src/Auth/CorePermissions.php +++ b/src/Auth/CorePermissions.php @@ -267,6 +267,6 @@ protected function permission($permission) protected function group($name, $callback) { - return Permission::group($name, __('statamic::permissions.group_'.$name), $callback); + Permission::group($name, __('statamic::permissions.group_'.$name), $callback); } } diff --git a/src/Auth/Eloquent/Role.php b/src/Auth/Eloquent/Role.php index 1c2672e127c..e2d3b1909d9 100644 --- a/src/Auth/Eloquent/Role.php +++ b/src/Auth/Eloquent/Role.php @@ -4,6 +4,9 @@ use Statamic\Auth\File\Role as FileRole; +/** + * @phpstan-consistent-constructor + */ class Role extends FileRole { protected $model; diff --git a/src/Auth/Eloquent/UserGroup.php b/src/Auth/Eloquent/UserGroup.php index e75268b5c83..9b02ba64904 100644 --- a/src/Auth/Eloquent/UserGroup.php +++ b/src/Auth/Eloquent/UserGroup.php @@ -6,6 +6,9 @@ use Statamic\Auth\File\UserGroup as FileUserGroup; use Statamic\Facades\User; +/** + * @phpstan-consistent-constructor + */ class UserGroup extends FileUserGroup { protected $model; diff --git a/src/Auth/UserCollection.php b/src/Auth/UserCollection.php index 1f3cae54120..186122b0066 100644 --- a/src/Auth/UserCollection.php +++ b/src/Auth/UserCollection.php @@ -9,14 +9,4 @@ */ class UserCollection extends DataCollection { - /** - * Get the collection as an array. - * - * @param bool $supplement - * @return array - */ - public function extract($supplement = false) - { - return UserService::transform($this->items, $supplement); - } } diff --git a/src/CP/Column.php b/src/CP/Column.php index 0bf83d59a5e..78b662623a7 100644 --- a/src/CP/Column.php +++ b/src/CP/Column.php @@ -5,6 +5,9 @@ use Statamic\Support\Str; use Statamic\Support\Traits\FluentlyGetsAndSets; +/** + * @phpstan-consistent-constructor + */ class Column { use FluentlyGetsAndSets; diff --git a/src/CP/Navigation/CoreNav.php b/src/CP/Navigation/CoreNav.php index 7aba785ce88..036e622cd1a 100644 --- a/src/CP/Navigation/CoreNav.php +++ b/src/CP/Navigation/CoreNav.php @@ -25,6 +25,9 @@ use Statamic\Facades\Utility; use Statamic\Statamic; +/** + * @phpstan-consistent-constructor + */ class CoreNav { /** diff --git a/src/CP/Navigation/NavPreferencesNormalizer.php b/src/CP/Navigation/NavPreferencesNormalizer.php index 5d12eab1771..82318c342f0 100644 --- a/src/CP/Navigation/NavPreferencesNormalizer.php +++ b/src/CP/Navigation/NavPreferencesNormalizer.php @@ -6,6 +6,9 @@ use Statamic\Support\Arr; use Statamic\Support\Str; +/** + * @phpstan-consistent-constructor + */ class NavPreferencesNormalizer { protected $preferences; diff --git a/src/CP/Navigation/NavTransformer.php b/src/CP/Navigation/NavTransformer.php index 67f91148278..9fece64d4cd 100644 --- a/src/CP/Navigation/NavTransformer.php +++ b/src/CP/Navigation/NavTransformer.php @@ -8,6 +8,9 @@ use Statamic\Support\Arr; use Statamic\Support\Str; +/** + * @phpstan-consistent-constructor + */ class NavTransformer { protected $coreNav; diff --git a/src/Console/Commands/AssetsGeneratePresets.php b/src/Console/Commands/AssetsGeneratePresets.php index 328c49fe8a9..c7133f97ccd 100644 --- a/src/Console/Commands/AssetsGeneratePresets.php +++ b/src/Console/Commands/AssetsGeneratePresets.php @@ -3,7 +3,6 @@ namespace Statamic\Console\Commands; use Illuminate\Console\Command; -use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Support\Facades\Log; use Statamic\Console\RunsInPlease; use Statamic\Facades\AssetContainer; @@ -113,9 +112,7 @@ protected function generatePresets($container, ?string $filterPreset = null) $counts[$preset] = ($counts[$preset] ?? 0) + 1; $progress->label("Generating $preset for {$asset->basename()}..."); - $dispatchMethod = $this->shouldQueue - ? 'dispatch' - : (method_exists(Dispatcher::class, 'dispatchSync') ? 'dispatchSync' : 'dispatchNow'); + $dispatchMethod = $this->shouldQueue ? 'dispatch' : 'dispatchSync'; try { GeneratePresetImageManipulation::$dispatchMethod($asset, $preset); diff --git a/src/Console/Commands/FlatCamp.php b/src/Console/Commands/FlatCamp.php index 22fee9d7fec..339cf8d570d 100644 --- a/src/Console/Commands/FlatCamp.php +++ b/src/Console/Commands/FlatCamp.php @@ -63,7 +63,7 @@ class FlatCamp extends Command public function handle() { - return $this->comment(collect($this->quotes) + $this->comment(collect($this->quotes) ->map(fn ($quote) => $this->formatForConsole($quote)) ->random()); } diff --git a/src/Console/Commands/InstallEloquentDriver.php b/src/Console/Commands/InstallEloquentDriver.php index 19b78c86ba0..2e26e7d8faf 100644 --- a/src/Console/Commands/InstallEloquentDriver.php +++ b/src/Console/Commands/InstallEloquentDriver.php @@ -209,6 +209,9 @@ protected function repositoryHasBeenMigrated(string $repository): bool case 'tokens': return config('statamic.eloquent-driver.tokens.driver') === 'eloquent'; + + default: + throw new \LogicException("Unknown repository: {$repository}"); } } diff --git a/src/Console/Commands/InstallSsg.php b/src/Console/Commands/InstallSsg.php index 404e5b1b453..1fc25ece015 100644 --- a/src/Console/Commands/InstallSsg.php +++ b/src/Console/Commands/InstallSsg.php @@ -39,7 +39,9 @@ class InstallSsg extends Command public function handle() { if (Composer::isInstalled('statamic/ssg')) { - return error('The Static Site Generator package is already installed.'); + error('The Static Site Generator package is already installed.'); + + return; } spin( diff --git a/src/Console/Commands/SiteClear.php b/src/Console/Commands/SiteClear.php index a4156378f47..28bd24035fb 100644 --- a/src/Console/Commands/SiteClear.php +++ b/src/Console/Commands/SiteClear.php @@ -42,7 +42,9 @@ class SiteClear extends Command public function handle() { if ($this->shouldAbort()) { - return $this->info('Aborted successfully.'); + $this->info('Aborted successfully.'); + + return; } $this->files = app(Filesystem::class); diff --git a/src/Console/Composer/Lock.php b/src/Console/Composer/Lock.php index 7ba5a773191..764fef5c07e 100644 --- a/src/Console/Composer/Lock.php +++ b/src/Console/Composer/Lock.php @@ -9,6 +9,9 @@ use Statamic\Facades\Path; use Statamic\UpdateScripts\UpdateScript; +/** + * @phpstan-consistent-constructor + */ class Lock { protected $files; diff --git a/src/Console/Processes/Process.php b/src/Console/Processes/Process.php index dd302629734..b59e9c85476 100644 --- a/src/Console/Processes/Process.php +++ b/src/Console/Processes/Process.php @@ -12,6 +12,9 @@ use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process as SymfonyProcess; +/** + * @phpstan-consistent-constructor + */ class Process { const CACHE_EXPIRY_MINUTES = 10; diff --git a/src/Data/BulkAugmentor.php b/src/Data/BulkAugmentor.php index 018b1b52c27..9e5ef00505d 100644 --- a/src/Data/BulkAugmentor.php +++ b/src/Data/BulkAugmentor.php @@ -5,6 +5,9 @@ use Statamic\Contracts\Data\Augmentable; use Statamic\Contracts\Data\BulkAugmentable; +/** + * @phpstan-consistent-constructor + */ class BulkAugmentor { private $isTree = false; diff --git a/src/Data/DataCollection.php b/src/Data/DataCollection.php index 76a5434aa41..2cbad8df46f 100644 --- a/src/Data/DataCollection.php +++ b/src/Data/DataCollection.php @@ -13,6 +13,8 @@ /** * An abstract collection of data types. + * + * @phpstan-consistent-constructor */ class DataCollection extends IlluminateCollection { diff --git a/src/Data/DataReferenceUpdater.php b/src/Data/DataReferenceUpdater.php index 1eaaf2974ff..8f861c90125 100644 --- a/src/Data/DataReferenceUpdater.php +++ b/src/Data/DataReferenceUpdater.php @@ -7,6 +7,9 @@ use Statamic\Git\Subscriber as GitSubscriber; use Statamic\Support\Arr; +/** + * @phpstan-consistent-constructor + */ abstract class DataReferenceUpdater { /** diff --git a/src/Events/AddonSettingsSaving.php b/src/Events/AddonSettingsSaving.php index 0d2b91534c3..a854555758c 100644 --- a/src/Events/AddonSettingsSaving.php +++ b/src/Events/AddonSettingsSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AddonSettingsSaving extends Event { public function __construct(public $settings) diff --git a/src/Events/AssetContainerCreating.php b/src/Events/AssetContainerCreating.php index a621cdfd638..35a7661b37f 100644 --- a/src/Events/AssetContainerCreating.php +++ b/src/Events/AssetContainerCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AssetContainerCreating extends Event { public function __construct(public $container) diff --git a/src/Events/AssetContainerDeleting.php b/src/Events/AssetContainerDeleting.php index 2f0d7908096..41eb66629c5 100644 --- a/src/Events/AssetContainerDeleting.php +++ b/src/Events/AssetContainerDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AssetContainerDeleting extends Event { public function __construct(public $container) diff --git a/src/Events/AssetContainerSaving.php b/src/Events/AssetContainerSaving.php index f71c9240741..5793d022553 100644 --- a/src/Events/AssetContainerSaving.php +++ b/src/Events/AssetContainerSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AssetContainerSaving extends Event { public function __construct(public $container) diff --git a/src/Events/AssetCreating.php b/src/Events/AssetCreating.php index a375c80c9b0..a5cf9e264fa 100644 --- a/src/Events/AssetCreating.php +++ b/src/Events/AssetCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AssetCreating extends Event { public function __construct(public $asset) diff --git a/src/Events/AssetDeleting.php b/src/Events/AssetDeleting.php index 2eadb47767a..a12777bd6ef 100644 --- a/src/Events/AssetDeleting.php +++ b/src/Events/AssetDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AssetDeleting extends Event { public function __construct(public $asset) diff --git a/src/Events/AssetSaving.php b/src/Events/AssetSaving.php index 535f75b9381..b5370525d6d 100644 --- a/src/Events/AssetSaving.php +++ b/src/Events/AssetSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class AssetSaving extends Event { public function __construct(public $asset) diff --git a/src/Events/BlueprintCreating.php b/src/Events/BlueprintCreating.php index 44425253d5c..ba615a4843b 100644 --- a/src/Events/BlueprintCreating.php +++ b/src/Events/BlueprintCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class BlueprintCreating extends Event { public function __construct(public $blueprint) diff --git a/src/Events/BlueprintDeleting.php b/src/Events/BlueprintDeleting.php index 9d3b3f8330c..37568d28b3c 100644 --- a/src/Events/BlueprintDeleting.php +++ b/src/Events/BlueprintDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class BlueprintDeleting extends Event { public function __construct(public $blueprint) diff --git a/src/Events/BlueprintSaving.php b/src/Events/BlueprintSaving.php index 1129baa2b97..dd82e2f04b5 100644 --- a/src/Events/BlueprintSaving.php +++ b/src/Events/BlueprintSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class BlueprintSaving extends Event { public function __construct(public $blueprint) diff --git a/src/Events/CollectionCreating.php b/src/Events/CollectionCreating.php index f60b8588a26..7b350d493a4 100644 --- a/src/Events/CollectionCreating.php +++ b/src/Events/CollectionCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class CollectionCreating extends Event { public function __construct(public $collection) diff --git a/src/Events/CollectionDeleting.php b/src/Events/CollectionDeleting.php index d216bf60431..3b45121c2e1 100644 --- a/src/Events/CollectionDeleting.php +++ b/src/Events/CollectionDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class CollectionDeleting extends Event { public function __construct(public $collection) diff --git a/src/Events/CollectionSaving.php b/src/Events/CollectionSaving.php index 4d028036832..1496be50f5f 100644 --- a/src/Events/CollectionSaving.php +++ b/src/Events/CollectionSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class CollectionSaving extends Event { public function __construct(public $collection) diff --git a/src/Events/CollectionTreeSaving.php b/src/Events/CollectionTreeSaving.php index 27be32b9d31..14151a436b2 100644 --- a/src/Events/CollectionTreeSaving.php +++ b/src/Events/CollectionTreeSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class CollectionTreeSaving extends Event { public function __construct(public $tree) diff --git a/src/Events/EntryCreating.php b/src/Events/EntryCreating.php index 9e6c782611a..355e9a33509 100644 --- a/src/Events/EntryCreating.php +++ b/src/Events/EntryCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class EntryCreating extends Event { public function __construct(public $entry) diff --git a/src/Events/EntryDeleting.php b/src/Events/EntryDeleting.php index 8d62b8104cf..056a6ebd5e3 100644 --- a/src/Events/EntryDeleting.php +++ b/src/Events/EntryDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class EntryDeleting extends Event { public function __construct(public $entry) diff --git a/src/Events/EntrySaving.php b/src/Events/EntrySaving.php index 06539c14a12..bfc6a2ca2cd 100644 --- a/src/Events/EntrySaving.php +++ b/src/Events/EntrySaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class EntrySaving extends Event { public function __construct(public $entry) diff --git a/src/Events/FieldsetCreating.php b/src/Events/FieldsetCreating.php index a26fd6d306c..f913c41ee97 100644 --- a/src/Events/FieldsetCreating.php +++ b/src/Events/FieldsetCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class FieldsetCreating extends Event { public function __construct(public $fieldset) diff --git a/src/Events/FieldsetDeleting.php b/src/Events/FieldsetDeleting.php index af09dcbfab0..e70d8b863b3 100644 --- a/src/Events/FieldsetDeleting.php +++ b/src/Events/FieldsetDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class FieldsetDeleting extends Event { public function __construct(public $fieldset) diff --git a/src/Events/FieldsetSaving.php b/src/Events/FieldsetSaving.php index ef7ed931132..0feea9cbf6a 100644 --- a/src/Events/FieldsetSaving.php +++ b/src/Events/FieldsetSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class FieldsetSaving extends Event { public function __construct(public $fieldset) diff --git a/src/Events/FormCreating.php b/src/Events/FormCreating.php index e9a86eefdd4..3b404779f47 100644 --- a/src/Events/FormCreating.php +++ b/src/Events/FormCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class FormCreating extends Event { public function __construct(public $form) diff --git a/src/Events/FormDeleting.php b/src/Events/FormDeleting.php index 35745cfd34d..3d991e068b5 100644 --- a/src/Events/FormDeleting.php +++ b/src/Events/FormDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class FormDeleting extends Event { public function __construct(public $form) diff --git a/src/Events/FormSaving.php b/src/Events/FormSaving.php index 513f818485d..058c535fc08 100644 --- a/src/Events/FormSaving.php +++ b/src/Events/FormSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class FormSaving extends Event { public function __construct(public $form) diff --git a/src/Events/FormSubmitted.php b/src/Events/FormSubmitted.php index cb81358b3c1..f03780d6624 100644 --- a/src/Events/FormSubmitted.php +++ b/src/Events/FormSubmitted.php @@ -4,6 +4,9 @@ use Statamic\Contracts\Forms\Submission; +/** + * @phpstan-consistent-constructor + */ class FormSubmitted extends Event { public function __construct(public Submission $submission) diff --git a/src/Events/GlobalSetCreating.php b/src/Events/GlobalSetCreating.php index 5d535df8f6f..576a1d9973c 100644 --- a/src/Events/GlobalSetCreating.php +++ b/src/Events/GlobalSetCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class GlobalSetCreating extends Event { public function __construct(public $globals) diff --git a/src/Events/GlobalSetDeleting.php b/src/Events/GlobalSetDeleting.php index 570098c1f9d..7db7336f5ca 100644 --- a/src/Events/GlobalSetDeleting.php +++ b/src/Events/GlobalSetDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class GlobalSetDeleting extends Event { public function __construct(public $globals) diff --git a/src/Events/GlobalSetSaving.php b/src/Events/GlobalSetSaving.php index 1a3b3e6352f..d8797dbfda4 100644 --- a/src/Events/GlobalSetSaving.php +++ b/src/Events/GlobalSetSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class GlobalSetSaving extends Event { public function __construct(public $globals) diff --git a/src/Events/GlobalVariablesCreating.php b/src/Events/GlobalVariablesCreating.php index 630a25633f9..d231c275362 100644 --- a/src/Events/GlobalVariablesCreating.php +++ b/src/Events/GlobalVariablesCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class GlobalVariablesCreating extends Event { public function __construct(public $variables) diff --git a/src/Events/GlobalVariablesDeleting.php b/src/Events/GlobalVariablesDeleting.php index 69c24b3f47b..3427092cf69 100644 --- a/src/Events/GlobalVariablesDeleting.php +++ b/src/Events/GlobalVariablesDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class GlobalVariablesDeleting extends Event { public function __construct(public $variables) diff --git a/src/Events/GlobalVariablesSaving.php b/src/Events/GlobalVariablesSaving.php index 594ea22bc22..7cd18bbfc9d 100644 --- a/src/Events/GlobalVariablesSaving.php +++ b/src/Events/GlobalVariablesSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class GlobalVariablesSaving extends Event { public function __construct(public $variables) diff --git a/src/Events/NavCreating.php b/src/Events/NavCreating.php index ada7d791e3d..7f68d7afc39 100644 --- a/src/Events/NavCreating.php +++ b/src/Events/NavCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class NavCreating extends Event { public function __construct(public $nav) diff --git a/src/Events/NavDeleting.php b/src/Events/NavDeleting.php index d64882ffc75..26cbc52fbc6 100644 --- a/src/Events/NavDeleting.php +++ b/src/Events/NavDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class NavDeleting extends Event { public function __construct(public $nav) diff --git a/src/Events/NavSaving.php b/src/Events/NavSaving.php index 8ae6accbefe..a7852f248b6 100644 --- a/src/Events/NavSaving.php +++ b/src/Events/NavSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class NavSaving extends Event { public function __construct(public $nav) diff --git a/src/Events/NavTreeSaving.php b/src/Events/NavTreeSaving.php index 58b117e7ab4..3b5b47fb06b 100644 --- a/src/Events/NavTreeSaving.php +++ b/src/Events/NavTreeSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class NavTreeSaving extends Event { public function __construct(public $tree) diff --git a/src/Events/RevisionSaving.php b/src/Events/RevisionSaving.php index 8d295b2f00f..2ae55ff96c0 100644 --- a/src/Events/RevisionSaving.php +++ b/src/Events/RevisionSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class RevisionSaving extends Event { public function __construct(public $revision) diff --git a/src/Events/SubmissionCreating.php b/src/Events/SubmissionCreating.php index a7ad5c930b0..cd2015d69f2 100644 --- a/src/Events/SubmissionCreating.php +++ b/src/Events/SubmissionCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class SubmissionCreating extends Event { public function __construct(public $submission) diff --git a/src/Events/SubmissionSaving.php b/src/Events/SubmissionSaving.php index e632a22fd48..732eb80e603 100644 --- a/src/Events/SubmissionSaving.php +++ b/src/Events/SubmissionSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class SubmissionSaving extends Event { public function __construct(public $submission) diff --git a/src/Events/TaxonomyCreating.php b/src/Events/TaxonomyCreating.php index 2f869eb4bed..3602fd766bb 100644 --- a/src/Events/TaxonomyCreating.php +++ b/src/Events/TaxonomyCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class TaxonomyCreating extends Event { public function __construct(public $taxonomy) diff --git a/src/Events/TaxonomyDeleting.php b/src/Events/TaxonomyDeleting.php index b157a192e8c..81d3b0a29bd 100644 --- a/src/Events/TaxonomyDeleting.php +++ b/src/Events/TaxonomyDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class TaxonomyDeleting extends Event { public function __construct(public $taxonomy) diff --git a/src/Events/TaxonomySaving.php b/src/Events/TaxonomySaving.php index fc1ac3e6568..c95daaa05eb 100644 --- a/src/Events/TaxonomySaving.php +++ b/src/Events/TaxonomySaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class TaxonomySaving extends Event { public function __construct(public $taxonomy) diff --git a/src/Events/TermCreating.php b/src/Events/TermCreating.php index d8432b528a7..56aad9a8059 100644 --- a/src/Events/TermCreating.php +++ b/src/Events/TermCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class TermCreating extends Event { public function __construct(public $term) diff --git a/src/Events/TermDeleting.php b/src/Events/TermDeleting.php index 179a7017884..422d7b03757 100644 --- a/src/Events/TermDeleting.php +++ b/src/Events/TermDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class TermDeleting extends Event { public function __construct(public $term) diff --git a/src/Events/TermSaving.php b/src/Events/TermSaving.php index da2d86d5a4c..1db28d7de51 100644 --- a/src/Events/TermSaving.php +++ b/src/Events/TermSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class TermSaving extends Event { public function __construct(public $term) diff --git a/src/Events/UserCreating.php b/src/Events/UserCreating.php index 55989dc3e45..e6346c7a336 100644 --- a/src/Events/UserCreating.php +++ b/src/Events/UserCreating.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class UserCreating extends Event { public function __construct(public $user) diff --git a/src/Events/UserDeleting.php b/src/Events/UserDeleting.php index 40192e48ae7..0921fba427e 100644 --- a/src/Events/UserDeleting.php +++ b/src/Events/UserDeleting.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class UserDeleting extends Event { public function __construct(public $user) diff --git a/src/Events/UserRegistering.php b/src/Events/UserRegistering.php index e9c8d513210..33be8f25695 100644 --- a/src/Events/UserRegistering.php +++ b/src/Events/UserRegistering.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class UserRegistering extends Event { public function __construct(public $user) diff --git a/src/Events/UserSaving.php b/src/Events/UserSaving.php index b42a0631525..c52f34e8984 100644 --- a/src/Events/UserSaving.php +++ b/src/Events/UserSaving.php @@ -2,6 +2,9 @@ namespace Statamic\Events; +/** + * @phpstan-consistent-constructor + */ class UserSaving extends Event { public function __construct(public $user) diff --git a/src/Facades/Icon.php b/src/Facades/Icon.php index 99d00b212b5..c4d7af49882 100644 --- a/src/Facades/Icon.php +++ b/src/Facades/Icon.php @@ -9,7 +9,7 @@ /** * @method static void register(string $name, string $directory) - * @method static Collection sets(string $name) + * @method static Collection sets() * @method static IconSet get(string $name) * @method static IconSet default() * diff --git a/src/Facades/Permission.php b/src/Facades/Permission.php index 00a32c8250d..b12eb044e28 100644 --- a/src/Facades/Permission.php +++ b/src/Facades/Permission.php @@ -6,7 +6,7 @@ use Statamic\Auth\Permissions; /** - * @method static void boot() + * @method static \Statamic\Auth\Permissions boot() * @method static void extend(\Closure $callback) * @method static \Statamic\Auth\Permission make(string $value) * @method static \Statamic\Auth\Permission register(string $permission, \Closure $callback = null) diff --git a/src/Facades/Taxonomy.php b/src/Facades/Taxonomy.php index 1abd25406a8..4da8bc96f70 100644 --- a/src/Facades/Taxonomy.php +++ b/src/Facades/Taxonomy.php @@ -16,8 +16,8 @@ * @method static void save(\Statamic\Contracts\Taxonomies\Taxonomy $taxonomy) * @method static void delete(\Statamic\Contracts\Taxonomies\Taxonomy $taxonomy) * @method static \Statamic\Contracts\Taxonomies\Taxonomy make(?string $handle = null) - * @method static addPreviewTargets(string $handle, array $targets) - * @method static additionalPreviewTargets(string $handle) + * @method static void addPreviewTargets(string $handle, array $targets) + * @method static \Illuminate\Support\Collection additionalPreviewTargets(string $handle) * * @see \Statamic\Stache\Repositories\TaxonomyRepository * @link \Statamic\Taxonomies\Taxonomy diff --git a/src/Facades/Term.php b/src/Facades/Term.php index 499e7089994..4616d57d607 100644 --- a/src/Facades/Term.php +++ b/src/Facades/Term.php @@ -18,8 +18,8 @@ * @method static TermContract findOrMake($id) * @method static TermContract findOr($id, \Closure $callback) * @method static TermContract make(string $slug = null) - * @method static save($term) - * @method static delete($term) + * @method static void save($term) + * @method static void delete($term) * @method static TermQueryBuilder query() * @method static int entriesCount(Term $term) * @method static void substitute($item) diff --git a/src/Facades/User.php b/src/Facades/User.php index 2baae604780..b3fbeb261b1 100644 --- a/src/Facades/User.php +++ b/src/Facades/User.php @@ -13,7 +13,7 @@ * @method static null|\Statamic\Contracts\Auth\User findByEmail(string $email) * @method static null|\Statamic\Contracts\Auth\User findByOAuthId(Provider $provider, string $id) * @method static \Statamic\Contracts\Auth\User findOrFail($id) - * @method static query() + * @method static \Statamic\Contracts\Query\Builder query() * @method static int count() * @method static null|\Statamic\Contracts\Auth\User current() * @method static null|\Statamic\Contracts\Auth\User fromUser($user) diff --git a/src/Fields/Field.php b/src/Fields/Field.php index a731e62ed76..2af853df882 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -16,6 +16,9 @@ use function Statamic\trans as __; +/** + * @phpstan-consistent-constructor + */ class Field implements Arrayable { protected $handle; diff --git a/src/Fields/Fields.php b/src/Fields/Fields.php index 054c14361de..f6707b50866 100644 --- a/src/Fields/Fields.php +++ b/src/Fields/Fields.php @@ -10,6 +10,9 @@ use Statamic\Facades\Fieldset as FieldsetRepository; use Statamic\Support\Arr; +/** + * @phpstan-consistent-constructor + */ class Fields { protected $items; diff --git a/src/Fields/Fieldtype.php b/src/Fields/Fieldtype.php index 4073e075635..2b8a67c5a5c 100644 --- a/src/Fields/Fieldtype.php +++ b/src/Fields/Fieldtype.php @@ -22,6 +22,7 @@ abstract class Fieldtype implements Arrayable protected static $title; protected static $binding = 'fieldtypes'; + protected static $preloadable = null; protected $field; protected $localizable = true; diff --git a/src/Fields/Validator.php b/src/Fields/Validator.php index 2f6c4d93989..394d7593795 100644 --- a/src/Fields/Validator.php +++ b/src/Fields/Validator.php @@ -6,6 +6,9 @@ use Statamic\Support\Arr; use Statamic\Support\Str; +/** + * @phpstan-consistent-constructor + */ class Validator { protected $fields; diff --git a/src/Fields/Value.php b/src/Fields/Value.php index 5ac457691ef..6a93a8b3cb5 100644 --- a/src/Fields/Value.php +++ b/src/Fields/Value.php @@ -15,6 +15,9 @@ use Statamic\View\Cascade; use Traversable; +/** + * @phpstan-consistent-constructor + */ class Value implements ArrayAccess, IteratorAggregate, JsonSerializable { private $resolver; diff --git a/src/Forms/Exceptions/BlueprintUndefinedException.php b/src/Forms/Exceptions/BlueprintUndefinedException.php index 15a687e99ba..bd9bd407dab 100644 --- a/src/Forms/Exceptions/BlueprintUndefinedException.php +++ b/src/Forms/Exceptions/BlueprintUndefinedException.php @@ -9,6 +9,9 @@ use Statamic\Forms\Form; use Statamic\Statamic; +/** + * @phpstan-consistent-constructor + */ class BlueprintUndefinedException extends LogicException implements ProvidesSolution { protected $form; diff --git a/src/Forms/Uploaders/AssetsUploader.php b/src/Forms/Uploaders/AssetsUploader.php index 1c4341ebf3e..c583604ad70 100644 --- a/src/Forms/Uploaders/AssetsUploader.php +++ b/src/Forms/Uploaders/AssetsUploader.php @@ -9,6 +9,9 @@ use Statamic\Fieldtypes\Assets\UndefinedContainerException; use Statamic\Support\Arr; +/** + * @phpstan-consistent-constructor + */ class AssetsUploader { protected $config; diff --git a/src/Forms/Uploaders/FilesUploader.php b/src/Forms/Uploaders/FilesUploader.php index 5a575b39e00..619580c36d1 100644 --- a/src/Forms/Uploaders/FilesUploader.php +++ b/src/Forms/Uploaders/FilesUploader.php @@ -5,6 +5,9 @@ use Statamic\Assets\FileUploader; use Statamic\Support\Arr; +/** + * @phpstan-consistent-constructor + */ class FilesUploader { protected $config; diff --git a/src/Git/CommitCommand.php b/src/Git/CommitCommand.php index cefcadd9fe2..ed944300e3d 100644 --- a/src/Git/CommitCommand.php +++ b/src/Git/CommitCommand.php @@ -34,15 +34,19 @@ class CommitCommand extends Command public function handle() { if (! config('statamic.git.enabled')) { - return $this->info(__('statamic::messages.git_disabled')); + $this->info(__('statamic::messages.git_disabled')); + + return; } if (! Git::statuses()) { - return $this->info(__('statamic::messages.git_nothing_to_commit')); + $this->info(__('statamic::messages.git_nothing_to_commit')); + + return; } Git::commit(); - return $this->info(__('Content committed')); + $this->info(__('Content committed')); } } diff --git a/src/GraphQL/Manager.php b/src/GraphQL/Manager.php index abf10241dbe..83e6be58934 100644 --- a/src/GraphQL/Manager.php +++ b/src/GraphQL/Manager.php @@ -23,12 +23,12 @@ public function getExtraTypeFields($type) public function addType($type) { - return GraphQL::addType($type); + GraphQL::addType($type); } public function addTypes($type) { - return GraphQL::addTypes($type); + GraphQL::addTypes($type); } public function type($type) diff --git a/src/GraphQL/Types/ArrayType.php b/src/GraphQL/Types/ArrayType.php index cdf8a13d3a5..325712cabd8 100644 --- a/src/GraphQL/Types/ArrayType.php +++ b/src/GraphQL/Types/ArrayType.php @@ -7,6 +7,9 @@ use GraphQL\Type\Definition\Type; use Rebing\GraphQL\Support\Contracts\TypeConvertible; +/** + * @phpstan-consistent-constructor + */ class ArrayType extends ScalarType implements TypeConvertible { const NAME = 'Array'; diff --git a/src/GraphQL/Types/TreeBranchType.php b/src/GraphQL/Types/TreeBranchType.php index 2a077c7502d..e1f48a80de9 100644 --- a/src/GraphQL/Types/TreeBranchType.php +++ b/src/GraphQL/Types/TreeBranchType.php @@ -6,6 +6,8 @@ abstract class TreeBranchType extends \Rebing\GraphQL\Support\Type { + const NAME = ''; + public function __construct() { $this->attributes['name'] = static::NAME; diff --git a/src/Http/Controllers/Concerns/HandlesLogins.php b/src/Http/Controllers/Concerns/HandlesLogins.php index d6b76ff58b6..e460d1afdac 100644 --- a/src/Http/Controllers/Concerns/HandlesLogins.php +++ b/src/Http/Controllers/Concerns/HandlesLogins.php @@ -22,7 +22,7 @@ protected function handleTooManyLoginAttempts(Request $request) if ($this->hasTooManyLoginAttempts($request)) { $this->fireLockoutEvent($request); - return $this->sendLockoutResponse($request); + $this->sendLockoutResponse($request); } } diff --git a/src/Http/Requests/FrontendFormRequest.php b/src/Http/Requests/FrontendFormRequest.php index 795e042044c..b720d576cd7 100644 --- a/src/Http/Requests/FrontendFormRequest.php +++ b/src/Http/Requests/FrontendFormRequest.php @@ -74,7 +74,7 @@ protected function failedValidation(Validator $validator) throw (new ValidationException($validator, $response)); } - return parent::failedValidation($validator); + parent::failedValidation($validator); } private function extraRules($fields) @@ -122,7 +122,7 @@ public function validateResolved() // directly in a headless format. In that case, we'll just use the default lang. $site = ($previousUrl = $this->previousUrl()) ? Site::findByUrl($previousUrl) : null; - return $this->withLocale($site?->lang(), fn () => parent::validateResolved()); + $this->withLocale($site?->lang(), fn () => parent::validateResolved()); } private function previousUrl() diff --git a/src/Http/Requests/UserLoginRequest.php b/src/Http/Requests/UserLoginRequest.php index bb29122e1ba..558625bb485 100644 --- a/src/Http/Requests/UserLoginRequest.php +++ b/src/Http/Requests/UserLoginRequest.php @@ -32,7 +32,7 @@ public function rules(): array protected function failedValidation(Validator $validator) { if ($this->isPrecognitive() || $this->wantsJson()) { - return parent::failedValidation($validator); + parent::failedValidation($validator); } if ($this->ajax()) { @@ -58,6 +58,6 @@ public function validateResolved() { $site = Site::findByUrl(LaravelURL::previous()) ?? Site::default(); - return $this->withLocale($site->lang(), fn () => parent::validateResolved()); + $this->withLocale($site->lang(), fn () => parent::validateResolved()); } } diff --git a/src/Http/Requests/UserPasswordRequest.php b/src/Http/Requests/UserPasswordRequest.php index d7cb084a507..bf7910ec3ae 100644 --- a/src/Http/Requests/UserPasswordRequest.php +++ b/src/Http/Requests/UserPasswordRequest.php @@ -32,7 +32,7 @@ public function rules(): array protected function failedValidation(Validator $validator) { if ($this->isPrecognitive() || $this->wantsJson()) { - return parent::failedValidation($validator); + parent::failedValidation($validator); } if ($this->ajax()) { @@ -58,6 +58,6 @@ public function validateResolved() { $site = Site::findByUrl(LaravelURL::previous()) ?? Site::default(); - return $this->withLocale($site->lang(), fn () => parent::validateResolved()); + $this->withLocale($site->lang(), fn () => parent::validateResolved()); } } diff --git a/src/Http/Requests/UserProfileRequest.php b/src/Http/Requests/UserProfileRequest.php index e025e29f3b1..22ab78d45d6 100644 --- a/src/Http/Requests/UserProfileRequest.php +++ b/src/Http/Requests/UserProfileRequest.php @@ -27,7 +27,7 @@ public function authorize(): bool protected function failedValidation(Validator $validator) { if ($this->isPrecognitive() || $this->wantsJson()) { - return parent::failedValidation($validator); + parent::failedValidation($validator); } if ($this->ajax()) { @@ -77,7 +77,7 @@ public function validateResolved() { $site = Site::findByUrl(LaravelURL::previous()) ?? Site::default(); - return $this->withLocale($site->lang(), fn () => parent::validateResolved()); + $this->withLocale($site->lang(), fn () => parent::validateResolved()); } private function valuesWithoutAssetFields($fields) diff --git a/src/Http/Requests/UserRegisterRequest.php b/src/Http/Requests/UserRegisterRequest.php index f126573bc9d..a2c4e4ee900 100644 --- a/src/Http/Requests/UserRegisterRequest.php +++ b/src/Http/Requests/UserRegisterRequest.php @@ -30,7 +30,7 @@ public function authorize(): bool protected function failedValidation(Validator $validator) { if ($this->isPrecognitive() || $this->wantsJson()) { - return parent::failedValidation($validator); + parent::failedValidation($validator); } if ($this->ajax()) { @@ -82,7 +82,7 @@ public function validateResolved() { $site = Site::findByUrl(LaravelURL::previous()) ?? Site::default(); - return $this->withLocale($site->lang(), fn () => parent::validateResolved()); + $this->withLocale($site->lang(), fn () => parent::validateResolved()); } private function valuesWithoutAssetFields($fields) diff --git a/src/Imaging/GuzzleAdapter.php b/src/Imaging/GuzzleAdapter.php index fb0562bd410..a7901dc1118 100644 --- a/src/Imaging/GuzzleAdapter.php +++ b/src/Imaging/GuzzleAdapter.php @@ -11,7 +11,9 @@ use League\Flysystem\Config; use League\Flysystem\FileAttributes; use League\Flysystem\FilesystemAdapter; +use League\Flysystem\UnableToListContents; use League\Flysystem\UnableToReadFile; +use League\Flysystem\UnableToRetrieveMetadata; use Statamic\Exceptions\InvalidRemoteUrlException; class GuzzleAdapter implements FilesystemAdapter @@ -101,22 +103,22 @@ public function writeStream(string $path, $contents, Config $config): void public function mimeType(string $path): FileAttributes { - // + throw UnableToRetrieveMetadata::mimeType($path, 'Not supported by '.static::class); } public function lastModified(string $path): FileAttributes { - // + throw UnableToRetrieveMetadata::lastModified($path, 'Not supported by '.static::class); } public function fileSize(string $path): FileAttributes { - // + throw UnableToRetrieveMetadata::fileSize($path, 'Not supported by '.static::class); } public function listContents(string $path, bool $deep): iterable { - // + throw UnableToListContents::atLocation($path, $deep, new \RuntimeException('Not supported by '.static::class)); } public function move(string $source, string $destination, Config $config): void @@ -146,7 +148,7 @@ public function deleteDirectory(string $prefix): void public function visibility(string $path): FileAttributes { - // + throw UnableToRetrieveMetadata::visibility($path, 'Not supported by '.static::class); } /* diff --git a/src/Markdown/Parser.php b/src/Markdown/Parser.php index 9c4a9aa7605..a36640c900c 100644 --- a/src/Markdown/Parser.php +++ b/src/Markdown/Parser.php @@ -9,6 +9,9 @@ use League\CommonMark\Extension\SmartPunct\SmartPunctExtension; use Statamic\Support\Arr; +/** + * @phpstan-consistent-constructor + */ class Parser { use Macroable; diff --git a/src/Mixins/Router.php b/src/Mixins/Router.php index 593af05d1f6..7f359e26581 100644 --- a/src/Mixins/Router.php +++ b/src/Mixins/Router.php @@ -4,6 +4,9 @@ use Statamic\Http\Controllers\FrontendController; +/** + * @mixin \Illuminate\Routing\Router + */ class Router { public function statamic() diff --git a/src/Providers/AppServiceProvider.php b/src/Providers/AppServiceProvider.php index b9aa25e36ed..4721714245d 100644 --- a/src/Providers/AppServiceProvider.php +++ b/src/Providers/AppServiceProvider.php @@ -97,6 +97,7 @@ public function boot() ], 'statamic-scaffolding'); $this->app['redirect']->macro('cpRoute', function ($route, $parameters = []) { + /** @var \Illuminate\Routing\Redirector $this */ return $this->to(cp_route($route, $parameters)); }); @@ -366,6 +367,7 @@ private function registerElevatedSessionMacros() }); Session::macro('elevate', function () { + /** @var \Illuminate\Session\Store $this */ $this->put('statamic_elevated_session', now()->timestamp); $this->forget('statamic_elevated_session_verification_code'); }); diff --git a/src/Providers/CollectionsServiceProvider.php b/src/Providers/CollectionsServiceProvider.php index 14cc476b5c8..a46f4a10446 100644 --- a/src/Providers/CollectionsServiceProvider.php +++ b/src/Providers/CollectionsServiceProvider.php @@ -7,6 +7,9 @@ use Illuminate\Support\ServiceProvider; use Statamic\Contracts\Data\Augmentable; +/** + * @phpstan-consistent-constructor + */ class CollectionsServiceProvider extends ServiceProvider { /** @@ -16,33 +19,12 @@ class CollectionsServiceProvider extends ServiceProvider */ public function register() { - $this->getOrPut(); $this->keyByWithKey(); $this->l10n(); - $this->pipe(); $this->transpose(); $this->toAugmentedArray(); } - /** - * Get a key from a collection if it exists, - * otherwise put a value in there and return it. - * - * @return void - */ - private function getOrPut() - { - Collection::macro('getOrPut', function ($key, $put) { - if ($this->has($key)) { - return $this->get($key); - } - - $this->put($key, $put); - - return $put; - }); - } - /** * The Laravel 5.3 way of doing keyBy. * @@ -81,7 +63,7 @@ private function l10n() * @param string $prefix This is for prefixing the keys for our addons. */ Collection::macro('localize', function ($prefix = null) { - return collect($this->items) + return collect($this->all()) ->filter(function ($item) { return pathinfo($item, PATHINFO_EXTENSION) == 'php'; }) @@ -94,18 +76,6 @@ private function l10n() }); } - /** - * Backport of the pipe method from 5.2. - * - * @return void - */ - private function pipe() - { - Collection::macro('pipe', function (callable $callback) { - return $callback($this); - }); - } - /** * "Transpose" a multidimensional array. * @@ -160,7 +130,7 @@ protected function toAugmentedArray() } return $value instanceof Arrayable ? $value->toArray() : $value; - }, $this->items); + }, $this->all()); }); Collection::macro('toDeferredAugmentedArray', function ($keys = null) { @@ -170,7 +140,7 @@ protected function toAugmentedArray() } return $value instanceof Arrayable ? $value->toArray() : $value; - }, $this->items); + }, $this->all()); }); Collection::macro('toAugmentedCollection', function ($keys = null) { @@ -180,7 +150,7 @@ protected function toAugmentedArray() } return $value instanceof Arrayable ? $value->toArray() : $value; - }, $this->items); + }, $this->all()); }); Collection::macro('toEvaluatedAugmentedArray', function ($keys = null) { @@ -190,7 +160,7 @@ protected function toAugmentedArray() } return $value instanceof Arrayable ? $value->toArray() : $value; - }, $this->items); + }, $this->all()); }); } } diff --git a/src/Providers/ViewServiceProvider.php b/src/Providers/ViewServiceProvider.php index 7024b87efcf..a5661315580 100644 --- a/src/Providers/ViewServiceProvider.php +++ b/src/Providers/ViewServiceProvider.php @@ -26,7 +26,6 @@ use Statamic\View\Debugbar\AntlersProfiler\PerformanceCollector; use Statamic\View\Debugbar\AntlersProfiler\PerformanceTracer; use Statamic\View\Interop\Stacks; -use Statamic\View\Store; class ViewServiceProvider extends ServiceProvider { @@ -37,8 +36,6 @@ class ViewServiceProvider extends ServiceProvider */ public function register() { - $this->app->singleton(Store::class); - $this->app->singleton(Cascade::class, function ($app) { return new Cascade($app['request'], Site::current()); }); @@ -439,8 +436,8 @@ public function boot() }); View::macro('withoutExtractions', function () { - if ($this->engine instanceof Engine) { - $this->engine->withoutExtractions(); + if ($this->getEngine() instanceof Engine) { + $this->getEngine()->withoutExtractions(); } return $this; diff --git a/src/Query/OrderBy.php b/src/Query/OrderBy.php index dce95d88972..d0e94b23392 100644 --- a/src/Query/OrderBy.php +++ b/src/Query/OrderBy.php @@ -2,6 +2,9 @@ namespace Statamic\Query; +/** + * @phpstan-consistent-constructor + */ class OrderBy { public $sort; diff --git a/src/Revisions/Revision.php b/src/Revisions/Revision.php index a804799ebd4..94b660815d4 100644 --- a/src/Revisions/Revision.php +++ b/src/Revisions/Revision.php @@ -16,6 +16,9 @@ use Statamic\Facades\Revision as Revisions; use Statamic\Support\Traits\FluentlyGetsAndSets; +/** + * @phpstan-consistent-constructor + */ class Revision implements Arrayable, ContainsQueryableValues, Contract { use ExistsAsFile, FluentlyGetsAndSets, TracksQueriedColumns, TracksQueriedRelations; diff --git a/src/Search/Null/NullIndex.php b/src/Search/Null/NullIndex.php index 10ebc808ade..7f0c2b2e1ee 100644 --- a/src/Search/Null/NullIndex.php +++ b/src/Search/Null/NullIndex.php @@ -34,6 +34,6 @@ protected function deleteIndex() public function searchables() { - return new NullSearchables($this); + return new NullSearchables(); } } diff --git a/src/Statamic.php b/src/Statamic.php index 67e9cf59ad9..abb4e4d839e 100644 --- a/src/Statamic.php +++ b/src/Statamic.php @@ -20,6 +20,9 @@ use Statamic\Support\TextDirection; use Statamic\Tags\FluentTag; +/** + * @phpstan-consistent-constructor + */ class Statamic { const CORE_SLUG = 'statamic'; diff --git a/src/Support/Arr.php b/src/Support/Arr.php index e522ee19639..664a4a39868 100644 --- a/src/Support/Arr.php +++ b/src/Support/Arr.php @@ -308,7 +308,7 @@ public static function pull(&$array, $key, $default = null) */ public static function forget(&$array, $keys) { - return IlluminateArr::forget($array, $keys); + IlluminateArr::forget($array, $keys); } /** diff --git a/src/Support/FileCollection.php b/src/Support/FileCollection.php index 5c6378b4036..389ce194253 100644 --- a/src/Support/FileCollection.php +++ b/src/Support/FileCollection.php @@ -10,6 +10,9 @@ use Symfony\Component\Finder\Comparator\DateComparator; use Symfony\Component\Finder\Comparator\NumberComparator; +/** + * @phpstan-consistent-constructor + */ class FileCollection extends Collection { /** diff --git a/src/Taxonomies/TermTracker.php b/src/Taxonomies/TermTracker.php deleted file mode 100644 index dda688c1771..00000000000 --- a/src/Taxonomies/TermTracker.php +++ /dev/null @@ -1,102 +0,0 @@ -stache = $stache; - $this->taxonomyStache = $stache->taxonomies; - } - - /** - * Register the listeners for the subscriber. - * - * @param \Illuminate\Events\Dispatcher $events - */ - public function subscribe($events) - { - $events->listen(RepositoryItemInserted::class, self::class.'@insert'); - $events->listen(RepositoryItemRemoved::class, self::class.'@remove'); - } - - public function insert(RepositoryItemInserted $event) - { - if ($event->item instanceof TaxonomyContract) { - $this->updateLocalizedTermUris($event->item); - - return; - } - - if (! method_exists($event->item, 'isTaxonomizable') || ! $event->item->isTaxonomizable()) { - return; - } - - Taxonomy::all()->each(function ($taxonomy, $handle) use ($event) { - if ($event->item->has($handle)) { - try { - $this->addTerms($handle, $event->item); - } catch (\Exception $e) { - \Log::debug('There was a problem adding taxonomy terms to data with ID '.$event->item->id()); - \Log::debug($e->getMessage().PHP_EOL.$e->getTraceAsString()); - } - } - }); - } - - private function addTerms($taxonomy, $item) - { - // Don't do anything if there aren't any terms. - if (! $values = $item->get($taxonomy)) { - return; - } - - $this->taxonomyStache->syncAssociations( - $item->id(), - $taxonomy, - (array) $item->get($taxonomy) - ); - } - - private function updateLocalizedTermUris($taxonomy) - { - $terms = []; - - $this->taxonomyStache->clearLocalizedUris(); - - // Collect all the terms that have had their slugs localized. - foreach ($taxonomy->get('slugs', []) as $locale => $slugs) { - foreach ((array) $slugs as $slug => $localizedSlug) { - $terms[] = $slug; - } - } - - // Now that we have the terms (not concerned with the locales - // now) we can let the Stache sort out the respective URIs. - foreach (collect($terms)->unique() as $term) { - $this->taxonomyStache->addUris($taxonomy->basename(), $term); - } - } - - public function remove(RepositoryItemRemoved $event) - { - $this->taxonomyStache->removeData($event->id); - } -} diff --git a/src/View/Debugbar/AddRequestMessage.php b/src/View/Debugbar/AddRequestMessage.php index f3726721e8a..7dcda1dab17 100644 --- a/src/View/Debugbar/AddRequestMessage.php +++ b/src/View/Debugbar/AddRequestMessage.php @@ -3,7 +3,6 @@ namespace Statamic\View\Debugbar; use Illuminate\Database\Eloquent\Model; -use Statamic\Routing\Route; use Statamic\View\Events\ViewRendered; class AddRequestMessage @@ -30,10 +29,6 @@ public function handle(ViewRendered $event) protected function label($item) { - if ($item instanceof Route) { - return 'Route '.$item->url(); - } - if ($item instanceof Model) { return class_basename($item).' '.$item->getKey(); } diff --git a/src/View/Scaffolding/Emitters/AbstractSourceEmitter.php b/src/View/Scaffolding/Emitters/AbstractSourceEmitter.php index e0cda8d4768..903b5d7c23c 100644 --- a/src/View/Scaffolding/Emitters/AbstractSourceEmitter.php +++ b/src/View/Scaffolding/Emitters/AbstractSourceEmitter.php @@ -10,9 +10,14 @@ use Statamic\View\Scaffolding\TemplateGenerator; use Stringable; +/** + * @phpstan-consistent-constructor + */ abstract class AbstractSourceEmitter implements Stringable { protected static array $blueprintStack = []; + protected static array $variableStack = []; + protected static ?string $currentIterationVar = null; protected array $specialLoopVariables = [ 'key', 'value', diff --git a/src/Widgets/VueComponent.php b/src/Widgets/VueComponent.php index 9e6601a981f..cdaa544b726 100644 --- a/src/Widgets/VueComponent.php +++ b/src/Widgets/VueComponent.php @@ -4,6 +4,9 @@ use Illuminate\Contracts\Support\Arrayable; +/** + * @phpstan-consistent-constructor + */ class VueComponent implements Arrayable { public function __construct(private string $name, private array $props = [])