Skip to content

NOW MANAGED ON CODEBERG

Fixed entity excerpt function signature misalignment

Dan Brownd9cde4123def
diff --git a/app/Entities/Book.php b/app/Entities/Book.php
index e722c4b10..77cacf632 100644
--- a/app/Entities/Book.php
+++ b/app/Entities/Book.php
@@ -101,7 +101,7 @@ class Book extends Entity
* @param int $length
* @return string
*/
- public function getExcerpt($length = 100)
+ public function getExcerpt(int $length = 100)
{
$description = $this->description;
return strlen($description) > $length ? substr($description, 0, $length-3) . '...' : $description;
diff --git a/app/Entities/Bookshelf.php b/app/Entities/Bookshelf.php
index d6a3cf0ef..8f2cdf8ae 100644
--- a/app/Entities/Bookshelf.php
+++ b/app/Entities/Bookshelf.php
@@ -78,7 +78,7 @@ class Bookshelf extends Entity
* @param int $length
* @return string
*/
- public function getExcerpt($length = 100)
+ public function getExcerpt(int $length = 100)
{
$description = $this->description;
return strlen($description) > $length ? substr($description, 0, $length-3) . '...' : $description;
diff --git a/app/Entities/Entity.php b/app/Entities/Entity.php
index d648f68e4..482d21766 100644
--- a/app/Entities/Entity.php
+++ b/app/Entities/Entity.php
@@ -234,7 +234,7 @@ class Entity extends Ownable
if (mb_strlen($text) > $length) {
$text = mb_substr($text, 0, $length-3) . '...';
}
- return trim($text);
+ return trim($text);
}
/**