diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index f98ff2a..2b9e9a5 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.6.0 + uses: dependabot/fetch-metadata@v2.1.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index ef5387d..d9306d6 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -20,7 +20,7 @@ jobs: coverage: none - name: Install composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Run PHPStan run: ./vendor/bin/phpstan --error-format=github diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index dd50259..a194661 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -60,11 +60,6 @@ parameters: count: 1 path: src/Domain/Meta/Actions/ResolveContainerBindings.php - - - message: "#^Unable to resolve the template type TMapValue in call to method Illuminate\\\\Support\\\\Collection\\\\:\\:map\\(\\)$#" - count: 1 - path: src/Domain/Meta/Actions/ResolveContainerBindings.php - - message: "#^Parameter \\#1 \\$fqcn of class Soyhuce\\\\NextIdeHelper\\\\Domain\\\\Models\\\\Entities\\\\Model constructor expects class\\-string\\, class\\-string given\\.$#" count: 1 diff --git a/src/Domain/Models/Actions/ResolveModelAttributes.php b/src/Domain/Models/Actions/ResolveModelAttributes.php index 1e855bc..470984b 100644 --- a/src/Domain/Models/Actions/ResolveModelAttributes.php +++ b/src/Domain/Models/Actions/ResolveModelAttributes.php @@ -8,7 +8,7 @@ use Soyhuce\NextIdeHelper\Domain\Models\Entities\Model; /** - * @phpstan-type Column array{name: string, type_name: string, nullable: bool} + * @phpstan-type Column array{name: string, type_name: string, nullable: bool, comment: string|null} */ class ResolveModelAttributes implements ModelResolver { @@ -18,7 +18,7 @@ public function execute(Model $model): void $typeCaster = new AttributeTypeCaster($model); foreach ($columns as $column) { - $attribute = new Attribute($column['name'], $column['type_name']); + $attribute = new Attribute($column['name'], $column['type_name'], $column['comment']); $attribute->inDatabase = true; if ($column['nullable'] && !$this->forceNullableColumnAsNonNullable($model, $attribute)) { $attribute->nullable = true; diff --git a/src/Domain/Models/Entities/Attribute.php b/src/Domain/Models/Entities/Attribute.php index 58c59ec..db8fd95 100644 --- a/src/Domain/Models/Entities/Attribute.php +++ b/src/Domain/Models/Entities/Attribute.php @@ -22,10 +22,11 @@ class Attribute public ?string $comment = null; - public function __construct(string $name, string $type) + public function __construct(string $name, string $type, ?string $comment = null) { $this->name = $name; $this->setType($type); + $this->comment = $comment; $this->nullable = false; } diff --git a/tests/Feature/AliasesCommandTest.php b/tests/Feature/AliasesCommandTest.php index 1dc94ce..c39afe7 100644 --- a/tests/Feature/AliasesCommandTest.php +++ b/tests/Feature/AliasesCommandTest.php @@ -28,6 +28,9 @@ public function theCommandIsSuccessful(): void if (config('app.aliases.Schedule') === null) { AliasLoader::getInstance(['Schedule' => \Illuminate\Support\Facades\Schedule::class]); } + if (config('app.aliases.Context') === null) { + AliasLoader::getInstance(['Context' => \Illuminate\Support\Facades\Context::class]); + } config([ 'next-ide-helper.aliases' => [ diff --git a/tests/expected/_ide_aliases.stub b/tests/expected/_ide_aliases.stub index 8b1a0af..2da0276 100644 --- a/tests/expected/_ide_aliases.stub +++ b/tests/expected/_ide_aliases.stub @@ -38,6 +38,10 @@ namespace { } + class Context extends \Illuminate\Support\Facades\Context + { + } + class Cookie extends \Illuminate\Support\Facades\Cookie { }