Skip to content

NOW MANAGED ON CODEBERG

Maintenance: Updated larastan target level, fixed issues from tests

Dan Brown7d1c31620213
diff --git a/app/Access/Guards/ExternalBaseSessionGuard.php b/app/Access/Guards/ExternalBaseSessionGuard.php
index 899e93c36..91239599b 100644
--- a/app/Access/Guards/ExternalBaseSessionGuard.php
+++ b/app/Access/Guards/ExternalBaseSessionGuard.php
@@ -30,7 +30,7 @@ class ExternalBaseSessionGuard implements StatefulGuard
/**
* The user we last attempted to retrieve.
*/
- protected Authenticatable $lastAttempted;
+ protected Authenticatable|null $lastAttempted;
/**
* The session used by the guard.
diff --git a/app/Console/Commands/UpdateUrlCommand.php b/app/Console/Commands/UpdateUrlCommand.php
index e155878d3..71f0b92fe 100644
--- a/app/Console/Commands/UpdateUrlCommand.php
+++ b/app/Console/Commands/UpdateUrlCommand.php
@@ -52,7 +52,7 @@ class UpdateUrlCommand extends Command
'page_revisions' => ['html', 'text', 'markdown'],
'images' => ['url'],
'settings' => ['value'],
- 'comments' => ['html', 'text'],
+ 'comments' => ['html'],
];
foreach ($columnsToUpdateByTable as $table => $columns) {
diff --git a/app/Entities/Controllers/RecycleBinApiController.php b/app/Entities/Controllers/RecycleBinApiController.php
index fdc24ddf8..89bd3f41a 100644
--- a/app/Entities/Controllers/RecycleBinApiController.php
+++ b/app/Entities/Controllers/RecycleBinApiController.php
@@ -9,6 +9,7 @@ use BookStack\Entities\Models\Deletion;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\DeletionRepo;
use BookStack\Http\ApiController;
+use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasMany;
class RecycleBinApiController extends ApiController
@@ -69,7 +70,7 @@ class RecycleBinApiController extends ApiController
/**
* Load some related details for the deletion listing.
*/
- protected function listFormatter(Deletion $deletion)
+ protected function listFormatter(Deletion $deletion): void
{
$deletable = $deletion->deletable;
@@ -89,9 +90,9 @@ class RecycleBinApiController extends ApiController
}
/**
- * @param HasMany<Chapter|Page, Book|Chapter> $query
+ * @param Builder<Chapter|Page> $query
*/
- protected static function withTrashedQuery(HasMany $query): void
+ protected static function withTrashedQuery(Builder $query): void
{
$query->withTrashed();
}
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index 9dfd9d29e..72189222f 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -7,7 +7,7 @@ parameters:
- app
# The level 8 is the highest level
- level: 2
+ level: 3
phpVersion:
min: 80200
diff --git a/tests/Entity/CommentStoreTest.php b/tests/Entity/CommentStoreTest.php
index c5fe4ce50..de093a3a6 100644
--- a/tests/Entity/CommentStoreTest.php
+++ b/tests/Entity/CommentStoreTest.php
@@ -27,7 +27,6 @@ class CommentStoreTest extends TestCase
'local_id' => 1,
'entity_id' => $page->id,
'entity_type' => Page::newModelInstance()->getMorphClass(),
- 'text' => null,
'parent_id' => 2,
]);