diff --git a/extensions/tags/js/src/admin/components/SelectTagsSettingComponent.tsx b/extensions/tags/js/src/admin/components/SelectTagsSettingComponent.tsx index acf01fcd4..5eaa01db4 100644 --- a/extensions/tags/js/src/admin/components/SelectTagsSettingComponent.tsx +++ b/extensions/tags/js/src/admin/components/SelectTagsSettingComponent.tsx @@ -4,12 +4,12 @@ import Button from 'flarum/common/components/Button'; import LoadingIndicator from 'flarum/common/components/LoadingIndicator'; import tagsLabel from '../../common/helpers/tagsLabel'; -import type { CommonSettingsItemOptions } from 'flarum/admin/components/AdminPage'; +import type { CommonFieldOptions } from 'flarum/common/components/FormGroup'; import type Stream from 'flarum/common/utils/Stream'; import type { ITagSelectionModalAttrs } from '../../common/components/TagSelectionModal'; import type Tag from '../../common/models/Tag'; -export interface SelectTagsSettingComponentOptions extends CommonSettingsItemOptions { +export interface SelectTagsSettingComponentOptions extends CommonFieldOptions { type: 'flarum-tags.select-tags'; options?: ITagSelectionModalAttrs; } diff --git a/framework/core/src/Frontend/Compiler/Concerns/HasSources.php b/framework/core/src/Frontend/Compiler/Concerns/HasSources.php index 3a0bd2f8d..4f1c9f504 100644 --- a/framework/core/src/Frontend/Compiler/Concerns/HasSources.php +++ b/framework/core/src/Frontend/Compiler/Concerns/HasSources.php @@ -12,6 +12,9 @@ namespace Flarum\Frontend\Compiler\Concerns; use Flarum\Frontend\Compiler\Source\SourceCollector; use Flarum\Frontend\Compiler\Source\SourceInterface; +/** + * @template T of SourceInterface + */ trait HasSources { /** @@ -25,7 +28,7 @@ trait HasSources } /** - * @return SourceInterface[] + * @return T[] */ protected function getSources(): array { diff --git a/framework/core/src/Frontend/Compiler/JsDirectoryCompiler.php b/framework/core/src/Frontend/Compiler/JsDirectoryCompiler.php index d69be61dc..1059cc5f9 100644 --- a/framework/core/src/Frontend/Compiler/JsDirectoryCompiler.php +++ b/framework/core/src/Frontend/Compiler/JsDirectoryCompiler.php @@ -18,6 +18,8 @@ use Illuminate\Filesystem\FilesystemAdapter; /** * Used to copy JS files from a package directory to the assets' directory. * Without concatenating them. Primarily used for lazy loading JS modules. + * + * @uses HasSources */ class JsDirectoryCompiler implements CompilerInterface { @@ -44,6 +46,7 @@ class JsDirectoryCompiler implements CompilerInterface public function commit(bool $force = false): void { + /** @var DirectorySource $source */ foreach ($this->getSources() as $source) { $this->compileSource($source, $force); } @@ -51,6 +54,7 @@ class JsDirectoryCompiler implements CompilerInterface public function getUrl(): ?string { + /** @var DirectorySource $source */ foreach ($this->getSources() as $source) { $this->eachFile($source, fn (JsCompiler $compiler) => $compiler->getUrl()); } @@ -60,6 +64,7 @@ class JsDirectoryCompiler implements CompilerInterface public function flush(): void { + /** @var DirectorySource $source */ foreach ($this->getSources() as $source) { $this->flushSource($source); } diff --git a/php-packages/phpstan/larastan-extension.neon b/php-packages/phpstan/larastan-extension.neon index daeaa1130..869fcd0d0 100644 --- a/php-packages/phpstan/larastan-extension.neon +++ b/php-packages/phpstan/larastan-extension.neon @@ -12,6 +12,7 @@ parameters: bootstrapFiles: - bootstrap.php checkOctaneCompatibility: false + noEnvCallsOutsideOfConfig: false noModelMake: true noUnnecessaryCollectionCall: true noUnnecessaryCollectionCallOnly: [] @@ -24,9 +25,11 @@ parameters: checkModelProperties: false checkPhpDocMissingReturn: false checkUnusedViews: false + checkModelAppends: false parametersSchema: checkOctaneCompatibility: bool() + noEnvCallsOutsideOfConfig: bool() noModelMake: bool() noUnnecessaryCollectionCall: bool() noUnnecessaryCollectionCallOnly: listOf(string()) @@ -38,8 +41,11 @@ parametersSchema: disableSchemaScan: bool() checkModelProperties: bool() checkUnusedViews: bool() + checkModelAppends: bool() conditionalTags: + Larastan\Larastan\Rules\NoEnvCallsOutsideOfConfigRule: + phpstan.rules.rule: %noEnvCallsOutsideOfConfig% Larastan\Larastan\Rules\NoModelMakeRule: phpstan.rules.rule: %noModelMake% Larastan\Larastan\Rules\NoUnnecessaryCollectionCallRule: @@ -52,6 +58,8 @@ conditionalTags: phpstan.rules.rule: %checkModelProperties% Larastan\Larastan\Rules\UnusedViewsRule: phpstan.rules.rule: %checkUnusedViews% + Larastan\Larastan\Rules\ModelAppendsRule: + phpstan.rules.rule: %checkModelAppends% services: - @@ -163,6 +171,10 @@ services: class: Larastan\Larastan\Properties\ModelRelationsExtension tags: - phpstan.broker.propertiesClassReflectionExtension + - + class: Larastan\Larastan\ReturnTypes\ModelOnlyDynamicMethodReturnTypeExtension + tags: + - phpstan.broker.dynamicMethodReturnTypeExtension - class: Larastan\Larastan\ReturnTypes\ModelFactoryDynamicStaticMethodReturnTypeExtension @@ -287,7 +299,7 @@ services: - phpstan.broker.dynamicMethodReturnTypeExtension - - class: Larastan\Larastan\ReturnTypes\CollectionGenericStaticMethodDynamicMethodReturnTypeExtension + class: Larastan\Larastan\ReturnTypes\EnumerableGenericStaticMethodDynamicMethodReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension @@ -302,7 +314,7 @@ services: - phpstan.broker.dynamicMethodReturnTypeExtension - - class: Larastan\Larastan\ReturnTypes\CollectionGenericStaticMethodDynamicStaticMethodReturnTypeExtension + class: Larastan\Larastan\ReturnTypes\EnumerableGenericStaticMethodDynamicStaticMethodReturnTypeExtension tags: - phpstan.broker.dynamicStaticMethodReturnTypeExtension @@ -348,6 +360,11 @@ services: tags: - phpstan.broker.dynamicFunctionReturnTypeExtension + - + class: Larastan\Larastan\ReturnTypes\Helpers\StrExtension + tags: + - phpstan.broker.dynamicFunctionReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\Helpers\TapExtension tags: @@ -371,6 +388,9 @@ services: - class: Larastan\Larastan\Rules\OctaneCompatibilityRule + - + class: Larastan\Larastan\Rules\NoEnvCallsOutsideOfConfigRule + - class: Larastan\Larastan\Rules\NoModelMakeRule @@ -383,6 +403,9 @@ services: - class: Larastan\Larastan\Rules\ModelProperties\ModelPropertyRule + - + class: Larastan\Larastan\Rules\ModelAppendsRule + - class: Larastan\Larastan\Rules\ModelProperties\ModelPropertyStaticCallRule @@ -413,6 +436,7 @@ services: databaseMigrationPath: %databaseMigrationsPath% disableMigrationScan: %disableMigrationScan% parser: @currentPhpVersionSimpleDirectParser + reflectionProvider: @reflectionProvider - class: Larastan\Larastan\Properties\SquashedMigrationHelper @@ -423,6 +447,9 @@ services: - class: Larastan\Larastan\Properties\ModelCastHelper + - + class: Larastan\Larastan\Properties\ModelPropertyHelper + - class: Larastan\Larastan\Rules\ModelProperties\ModelPropertiesRuleHelper @@ -451,11 +478,14 @@ services: dispatchableClass: Illuminate\Foundation\Events\Dispatchable tags: - phpstan.rules.rule - - Larastan\Larastan\Properties\Schema\PhpMyAdminDataTypeToPhpTypeConverter + + - + class: Larastan\Larastan\Properties\Schema\PhpMyAdminDataTypeToPhpTypeConverter - class: Larastan\Larastan\LarastanStubFilesExtension - tags: [phpstan.stubFilesExtension] + tags: + - phpstan.stubFilesExtension - class: Larastan\Larastan\Rules\UnusedViewsRule @@ -507,35 +537,48 @@ services: class: Larastan\Larastan\ReturnTypes\ConsoleCommand\ArgumentDynamicReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\ConsoleCommand\HasArgumentDynamicReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\ConsoleCommand\OptionDynamicReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\ConsoleCommand\HasOptionDynamicReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\TranslatorGetReturnTypeExtension tags: - phpstan.broker.dynamicMethodReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\TransHelperReturnTypeExtension tags: - phpstan.broker.dynamicFunctionReturnTypeExtension + - class: Larastan\Larastan\ReturnTypes\DoubleUnderscoreHelperReturnTypeExtension tags: - phpstan.broker.dynamicFunctionReturnTypeExtension - - Larastan\Larastan\ReturnTypes\AppMakeHelper - - Larastan\Larastan\Internal\ConsoleApplicationResolver - - Larastan\Larastan\Internal\ConsoleApplicationHelper - - Larastan\Larastan\Support\HigherOrderCollectionProxyHelper + - + class: Larastan\Larastan\ReturnTypes\AppMakeHelper + + - + class: Larastan\Larastan\Internal\ConsoleApplicationResolver + + - + class: Larastan\Larastan\Internal\ConsoleApplicationHelper + + - + class: Larastan\Larastan\Support\HigherOrderCollectionProxyHelper rules: - Larastan\Larastan\Rules\UselessConstructs\NoUselessWithFunctionCallsRule