Skip to content

Commit

Permalink
Merge branch 'main' into resolve-issue-84
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien-phi committed Jun 5, 2024
2 parents 4685f2b + 487197d commit 4e2d063
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\\<string,object\\>\\:\\: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\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>, class\\-string given\\.$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Models/Actions/ResolveModelAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/Domain/Models/Entities/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Feature/AliasesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
4 changes: 4 additions & 0 deletions tests/expected/_ide_aliases.stub
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ namespace
{
}

class Context extends \Illuminate\Support\Facades\Context
{
}

class Cookie extends \Illuminate\Support\Facades\Cookie
{
}
Expand Down

0 comments on commit 4e2d063

Please sign in to comment.