Skip to content

Commit 5bf7578

Browse files
committed
Framework: Fixed Laravel 11 upgrade test issues, updated phpstan
- Fixed failing tests due to Laravel 11 changes - Updated phpstan to 3.x branch - Removed some seemingly redundant comment code, which was triggering phpstan.
1 parent cf9ccfc commit 5bf7578

8 files changed

+42
-79
lines changed

app/Activity/Models/Comment.php

-17
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class Comment extends Model implements Loggable
2626
use HasCreatorAndUpdater;
2727

2828
protected $fillable = ['parent_id'];
29-
protected $appends = ['created', 'updated'];
3029

3130
/**
3231
* Get the entity that this comment belongs to.
@@ -54,22 +53,6 @@ public function isUpdated(): bool
5453
return $this->updated_at->timestamp > $this->created_at->timestamp;
5554
}
5655

57-
/**
58-
* Get created date as a relative diff.
59-
*/
60-
public function getCreatedAttribute(): string
61-
{
62-
return $this->created_at->diffForHumans();
63-
}
64-
65-
/**
66-
* Get updated date as a relative diff.
67-
*/
68-
public function getUpdatedAttribute(): string
69-
{
70-
return $this->updated_at->diffForHumans();
71-
}
72-
7356
public function logDescriptor(): string
7457
{
7558
return "Comment #{$this->local_id} (ID: {$this->id}) for {$this->entity_type} (ID: {$this->entity_id})";

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"itsgoingd/clockwork": "^5.1",
4646
"mockery/mockery": "^1.5",
4747
"nunomaduro/collision": "^8.1",
48-
"larastan/larastan": "^2.7",
48+
"larastan/larastan": "^v3.0",
4949
"phpunit/phpunit": "^10.0",
5050
"squizlabs/php_codesniffer": "^3.7",
5151
"ssddanbrown/asserthtml": "^3.0"

composer.lock

+30-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

database/migrations/2015_08_31_175240_add_search_indexes.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,19 @@ public function up()
2626
*/
2727
public function down(): void
2828
{
29-
$sm = Schema::getConnection()->getDoctrineSchemaManager();
30-
$prefix = DB::getTablePrefix();
31-
$pages = $sm->introspectTable($prefix . 'pages');
32-
$books = $sm->introspectTable($prefix . 'books');
33-
$chapters = $sm->introspectTable($prefix . 'chapters');
34-
35-
if ($pages->hasIndex('search')) {
29+
if (Schema::hasIndex('pages', 'search')) {
3630
Schema::table('pages', function (Blueprint $table) {
3731
$table->dropIndex('search');
3832
});
3933
}
4034

41-
if ($books->hasIndex('search')) {
35+
if (Schema::hasIndex('books', 'search')) {
4236
Schema::table('books', function (Blueprint $table) {
4337
$table->dropIndex('search');
4438
});
4539
}
4640

47-
if ($chapters->hasIndex('search')) {
41+
if (Schema::hasIndex('chapters', 'search')) {
4842
Schema::table('chapters', function (Blueprint $table) {
4943
$table->dropIndex('search');
5044
});

database/migrations/2015_12_05_145049_fulltext_weighting.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,19 @@ public function up()
2626
*/
2727
public function down(): void
2828
{
29-
$sm = Schema::getConnection()->getDoctrineSchemaManager();
30-
$prefix = DB::getTablePrefix();
31-
$pages = $sm->introspectTable($prefix . 'pages');
32-
$books = $sm->introspectTable($prefix . 'books');
33-
$chapters = $sm->introspectTable($prefix . 'chapters');
34-
35-
if ($pages->hasIndex('name_search')) {
29+
if (Schema::hasIndex('pages', 'name_search')) {
3630
Schema::table('pages', function (Blueprint $table) {
3731
$table->dropIndex('name_search');
3832
});
3933
}
4034

41-
if ($books->hasIndex('name_search')) {
35+
if (Schema::hasIndex('books', 'name_search')) {
4236
Schema::table('books', function (Blueprint $table) {
4337
$table->dropIndex('name_search');
4438
});
4539
}
4640

47-
if ($chapters->hasIndex('name_search')) {
41+
if (Schema::hasIndex('chapters', 'name_search')) {
4842
Schema::table('chapters', function (Blueprint $table) {
4943
$table->dropIndex('name_search');
5044
});

database/migrations/2017_03_19_091553_create_search_index_table.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,21 @@ public function up(): void
2525
$table->index('score');
2626
});
2727

28-
$sm = Schema::getConnection()->getDoctrineSchemaManager();
29-
$prefix = DB::getTablePrefix();
30-
$pages = $sm->introspectTable($prefix . 'pages');
31-
$books = $sm->introspectTable($prefix . 'books');
32-
$chapters = $sm->introspectTable($prefix . 'chapters');
33-
34-
if ($pages->hasIndex('search')) {
28+
if (Schema::hasIndex('pages', 'search')) {
3529
Schema::table('pages', function (Blueprint $table) {
3630
$table->dropIndex('search');
3731
$table->dropIndex('name_search');
3832
});
3933
}
4034

41-
if ($books->hasIndex('search')) {
35+
if (Schema::hasIndex('books', 'search')) {
4236
Schema::table('books', function (Blueprint $table) {
4337
$table->dropIndex('search');
4438
$table->dropIndex('name_search');
4539
});
4640
}
4741

48-
if ($chapters->hasIndex('search')) {
42+
if (Schema::hasIndex('chapters', 'search')) {
4943
Schema::table('chapters', function (Blueprint $table) {
5044
$table->dropIndex('search');
5145
$table->dropIndex('name_search');

phpstan.neon.dist

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ parameters:
2121

2222
excludePaths:
2323
- ./Config/**/*.php
24-
- ./dev/**/*.php
25-
26-
checkMissingIterableValueType: false
24+
- ./dev/**/*.php

tests/Entity/PageTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function test_recently_updated_pages_view_shows_updated_by_details()
300300
]);
301301

302302
$resp = $this->asAdmin()->get('/pages/recently-updated');
303-
$this->withHtml($resp)->assertElementContains('.entity-list .page:nth-child(1)', 'Updated 1 second ago by ' . $user->name);
303+
$this->withHtml($resp)->assertElementContains('.entity-list .page:nth-child(1)', 'Updated 0 seconds ago by ' . $user->name);
304304
}
305305

306306
public function test_recently_updated_pages_view_shows_parent_chain()

0 commit comments

Comments
 (0)