Skip to content

Commit 78ebcb6

Browse files
committed
Addressed a range of deprecation warnings
Closes #3969
1 parent 28dda39 commit 78ebcb6

File tree

17 files changed

+33
-27
lines changed

17 files changed

+33
-27
lines changed

app/Entities/Tools/Markdown/MarkdownToHtml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use BookStack\Facades\Theme;
66
use BookStack\Theming\ThemeEvents;
77
use League\CommonMark\Block\Element\ListItem;
8-
use League\CommonMark\CommonMarkConverter;
98
use League\CommonMark\Environment;
109
use League\CommonMark\Extension\Table\TableExtension;
1110
use League\CommonMark\Extension\TaskList\TaskListExtension;
11+
use League\CommonMark\MarkdownConverter;
1212

1313
class MarkdownToHtml
1414
{
@@ -26,7 +26,7 @@ public function convert(): string
2626
$environment->addExtension(new TaskListExtension());
2727
$environment->addExtension(new CustomStrikeThroughExtension());
2828
$environment = Theme::dispatch(ThemeEvents::COMMONMARK_ENVIRONMENT_CONFIGURE, $environment) ?? $environment;
29-
$converter = new CommonMarkConverter([], $environment);
29+
$converter = new MarkdownConverter($environment);
3030

3131
$environment->addBlockRenderer(ListItem::class, new CustomListItemRenderer(), 10);
3232

app/Search/SearchIndex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ public function deleteEntityTerms(Entity $entity)
112112
*
113113
* @returns array<string, int>
114114
*/
115-
protected function generateTermScoreMapFromText(string $text, int $scoreAdjustment = 1): array
115+
protected function generateTermScoreMapFromText(string $text, float $scoreAdjustment = 1): array
116116
{
117117
$termMap = $this->textToTermCountMap($text);
118118

119119
foreach ($termMap as $term => $count) {
120-
$termMap[$term] = $count * $scoreAdjustment;
120+
$termMap[$term] = floor($count * $scoreAdjustment);
121121
}
122122

123123
return $termMap;

app/Util/CspService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function getBaseUri(): string
126126

127127
protected function getAllowedIframeHosts(): array
128128
{
129-
$hosts = config('app.iframe_hosts', '');
129+
$hosts = config('app.iframe_hosts') ?? '';
130130

131131
return array_filter(explode(' ', $hosts));
132132
}

database/factories/Actions/TagFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TagFactory extends Factory
2121
public function definition()
2222
{
2323
return [
24-
'name' => $this->faker->city,
24+
'name' => $this->faker->city(),
2525
'value' => $this->faker->sentence(3),
2626
];
2727
}

database/factories/Actions/WebhookFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function definition()
1818
{
1919
return [
2020
'name' => 'My webhook for ' . $this->faker->country(),
21-
'endpoint' => $this->faker->url,
21+
'endpoint' => $this->faker->url(),
2222
'active' => true,
2323
'timeout' => 3,
2424
];

database/factories/Auth/UserFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class UserFactory extends Factory
2222
*/
2323
public function definition()
2424
{
25-
$name = $this->faker->name;
25+
$name = $this->faker->name();
2626

2727
return [
2828
'name' => $name,
29-
'email' => $this->faker->email,
29+
'email' => $this->faker->email(),
3030
'slug' => Str::slug($name . '-' . Str::random(5)),
3131
'password' => Str::random(10),
3232
'remember_token' => Str::random(10),

database/factories/Entities/Models/BookFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class BookFactory extends Factory
2222
public function definition()
2323
{
2424
return [
25-
'name' => $this->faker->sentence,
25+
'name' => $this->faker->sentence(),
2626
'slug' => Str::random(10),
27-
'description' => $this->faker->paragraph,
27+
'description' => $this->faker->paragraph(),
2828
];
2929
}
3030
}

database/factories/Entities/Models/ChapterFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class ChapterFactory extends Factory
2222
public function definition()
2323
{
2424
return [
25-
'name' => $this->faker->sentence,
25+
'name' => $this->faker->sentence(),
2626
'slug' => Str::random(10),
27-
'description' => $this->faker->paragraph,
27+
'description' => $this->faker->paragraph(),
2828
];
2929
}
3030
}

database/factories/Entities/Models/PageFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function definition()
2424
$html = '<p>' . implode('</p>', $this->faker->paragraphs(5)) . '</p>';
2525

2626
return [
27-
'name' => $this->faker->sentence,
27+
'name' => $this->faker->sentence(),
2828
'slug' => Str::random(10),
2929
'html' => $html,
3030
'text' => strip_tags($html),

database/factories/Uploads/ImageFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class ImageFactory extends Factory
2121
public function definition()
2222
{
2323
return [
24-
'name' => $this->faker->slug . '.jpg',
25-
'url' => $this->faker->url,
26-
'path' => $this->faker->url,
24+
'name' => $this->faker->slug() . '.jpg',
25+
'url' => $this->faker->url(),
26+
'path' => $this->faker->url(),
2727
'type' => 'gallery',
2828
'uploaded_to' => 0,
2929
];

0 commit comments

Comments
 (0)