Skip to content

Commit

Permalink
Two improvements to improve typehinting, migrate to larastan/larastan…
Browse files Browse the repository at this point in the history
…, cleanup of test (#1750)
  • Loading branch information
lrljoe authored Jul 1, 2024
1 parent 5c40472 commit 119401b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"laravel/pint": "^1.10",
"monolog/monolog": "*",
"nunomaduro/collision": "^6.0|^7.0|^8.0",
"nunomaduro/larastan": "^2.6",
"larastan/larastan": "^2.6",
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.0|^10.0|^11.0"
},
Expand Down
6 changes: 3 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
includes:
- vendor/nunomaduro/larastan/extension.neon
- vendor/larastan/larastan/extension.neon

parameters:
paths:
Expand All @@ -10,11 +10,11 @@ parameters:
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- identifier: missingType.generics
- identifier: missingType.iterableValue
- '#Access to an undefined property Rappasoft\\LaravelLivewireTables\\Views\\Column\:\:\$view#'
- "#Unsafe usage of new static#"
- '#on array\<string, non-empty-array\<int\<0, max\>, mixed\>\> in empty\(\) does not exist.#'
Expand Down
2 changes: 1 addition & 1 deletion src/LaravelLivewireTablesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function boot(): void

}

public function consoleCommands()
public function consoleCommands(): void
{
if ($this->app->runningInConsole()) {

Expand Down
4 changes: 2 additions & 2 deletions src/Traits/Helpers/TableAttributeHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public function hasTableRowUrl(): bool
return $this->trUrlCallback !== null;
}

public function getTableRowUrl($row): ?string
public function getTableRowUrl(int|Model $row): ?string
{
return $this->trUrlCallback ? call_user_func($this->trUrlCallback, $row) : null;
}

public function getTableRowUrlTarget($row): ?string
public function getTableRowUrlTarget(int|Model $row): ?string
{
return $this->trUrlTargetCallback ? call_user_func($this->trUrlTargetCallback, $row) : null;
}
Expand Down
6 changes: 2 additions & 4 deletions tests/Views/Columns/LinkColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public function test_can_render_field_if_title_and_location_callback(): void
$this->assertNotEmpty($column);
}

/** @test */
public function can_check_ishtml_from_html_column(): void
public function test_can_check_ishtml_from_html_column(): void
{
$column = LinkColumn::make('Name', 'name')
->title(fn ($row) => 'Title')
Expand All @@ -55,8 +54,7 @@ public function can_check_ishtml_from_html_column(): void
$this->assertTrue($column->isHtml());
}

/** @test */
public function can_get_html_from_html_label_column(): void
public function test_can_get_html_from_html_label_column(): void
{
$column = LinkColumn::make('Name', 'name')
->title(fn ($row) => '<strong>My Label</strong>')
Expand Down

0 comments on commit 119401b

Please sign in to comment.