diff --git a/app/Actions/Activity.php b/app/Actions/Activity.php
index 9d256c9b2..c8590f0b2 100644
--- a/app/Actions/Activity.php
+++ b/app/Actions/Activity.php
@@ -6,6 +6,7 @@ use BookStack\Auth\User;
 use BookStack\Entities\Models\Entity;
 use BookStack\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\MorphTo;
 use Illuminate\Support\Str;
 
 /**
@@ -23,7 +24,7 @@ class Activity extends Model
     /**
      * Get the entity for this activity.
      */
-    public function entity()
+    public function entity(): MorphTo
     {
         if ($this->entity_type === '') {
             $this->entity_type = null;
diff --git a/app/Actions/ActivityType.php b/app/Actions/ActivityType.php
index 216f61249..ec02bed25 100644
--- a/app/Actions/ActivityType.php
+++ b/app/Actions/ActivityType.php
@@ -48,4 +48,4 @@ class ActivityType
     const AUTH_PASSWORD_RESET_UPDATE = 'auth_password_reset_update';
     const AUTH_LOGIN = 'auth_login';
     const AUTH_REGISTER = 'auth_register';
-}
\ No newline at end of file
+}
diff --git a/app/Api/ApiDocsGenerator.php b/app/Api/ApiDocsGenerator.php
index 2953647bb..8b520eda2 100644
--- a/app/Api/ApiDocsGenerator.php
+++ b/app/Api/ApiDocsGenerator.php
@@ -142,5 +142,4 @@ class ApiDocsGenerator
             ];
         });
     }
-
-}
\ No newline at end of file
+}
diff --git a/app/Api/ApiTokenGuard.php b/app/Api/ApiTokenGuard.php
index e0a50ebe3..59ab72f4e 100644
--- a/app/Api/ApiTokenGuard.php
+++ b/app/Api/ApiTokenGuard.php
@@ -163,4 +163,4 @@ class ApiTokenGuard implements Guard
     {
         $this->user = null;
     }
-}
\ No newline at end of file
+}
diff --git a/app/Auth/Access/Guards/ExternalBaseSessionGuard.php b/app/Auth/Access/Guards/ExternalBaseSessionGuard.php
index 9a0c691c8..b133754d8 100644
--- a/app/Auth/Access/Guards/ExternalBaseSessionGuard.php
+++ b/app/Auth/Access/Guards/ExternalBaseSessionGuard.php
@@ -299,5 +299,4 @@ class ExternalBaseSessionGuard implements StatefulGuard
 
         return $this;
     }
-
 }
diff --git a/app/Auth/Access/Guards/LdapSessionGuard.php b/app/Auth/Access/Guards/LdapSessionGuard.php
index 652141c0c..d761a30e6 100644
--- a/app/Auth/Access/Guards/LdapSessionGuard.php
+++ b/app/Auth/Access/Guards/LdapSessionGuard.php
@@ -23,13 +23,13 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
     /**
      * LdapSessionGuard constructor.
      */
-    public function __construct($name,
+    public function __construct(
+        $name,
         UserProvider $provider,
         Session $session,
         LdapService $ldapService,
         RegistrationService $registrationService
-    )
-    {
+    ) {
         $this->ldapService = $ldapService;
         parent::__construct($name, $provider, $session, $registrationService);
     }
@@ -119,5 +119,4 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
 
         return $this->registrationService->registerUser($details, null, false);
     }
-
 }
diff --git a/app/Auth/Access/Guards/Saml2SessionGuard.php b/app/Auth/Access/Guards/Saml2SessionGuard.php
index 68683bb43..044c2f383 100644
--- a/app/Auth/Access/Guards/Saml2SessionGuard.php
+++ b/app/Auth/Access/Guards/Saml2SessionGuard.php
@@ -34,5 +34,4 @@ class Saml2SessionGuard extends ExternalBaseSessionGuard
     {
         return false;
     }
-
 }
diff --git a/app/Auth/Access/RegistrationService.php b/app/Auth/Access/RegistrationService.php
index 2aff6c37d..9070d1241 100644
--- a/app/Auth/Access/RegistrationService.php
+++ b/app/Auth/Access/RegistrationService.php
@@ -83,7 +83,6 @@ class RegistrationService
                 $message = trans('auth.email_confirm_send_error');
                 throw new UserRegistrationException($message, '/register/confirm');
             }
-
         }
 
         return $newUser;
@@ -109,5 +108,4 @@ class RegistrationService
             throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), $redirect);
         }
     }
-
-}
\ No newline at end of file
+}
diff --git a/app/Entities/Tools/Markdown/CustomStrikeThroughExtension.php b/app/Entities/Tools/Markdown/CustomStrikeThroughExtension.php
index cb8b0ffc2..d4984ef08 100644
--- a/app/Entities/Tools/Markdown/CustomStrikeThroughExtension.php
+++ b/app/Entities/Tools/Markdown/CustomStrikeThroughExtension.php
@@ -13,4 +13,4 @@ class CustomStrikeThroughExtension implements ExtensionInterface
         $environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor());
         $environment->addInlineRenderer(Strikethrough::class, new CustomStrikethroughRenderer());
     }
-}
\ No newline at end of file
+}
diff --git a/app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php b/app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php
index 4371fb84c..7de95c263 100644
--- a/app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php
+++ b/app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php
@@ -21,4 +21,4 @@ class CustomStrikethroughRenderer implements InlineRendererInterface
 
         return new HtmlElement('s', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children()));
     }
-}
\ No newline at end of file
+}
diff --git a/app/Entities/Tools/SearchOptions.php b/app/Entities/Tools/SearchOptions.php
index 60e3a9b78..6c03c57a6 100644
--- a/app/Entities/Tools/SearchOptions.php
+++ b/app/Entities/Tools/SearchOptions.php
@@ -137,5 +137,4 @@ class SearchOptions
 
         return $string;
     }
-
-}
\ No newline at end of file
+}
diff --git a/app/Exceptions/ApiAuthException.php b/app/Exceptions/ApiAuthException.php
index cc68ba8cf..36ea8be9d 100644
--- a/app/Exceptions/ApiAuthException.php
+++ b/app/Exceptions/ApiAuthException.php
@@ -2,6 +2,7 @@
 
 namespace BookStack\Exceptions;
 
-class ApiAuthException extends UnauthorizedException {
+class ApiAuthException extends UnauthorizedException
+{
 
-}
\ No newline at end of file
+}
diff --git a/app/Exceptions/JsonDebugException.php b/app/Exceptions/JsonDebugException.php
index 6314533ce..e155579d6 100644
--- a/app/Exceptions/JsonDebugException.php
+++ b/app/Exceptions/JsonDebugException.php
@@ -22,4 +22,4 @@ class JsonDebugException extends Exception
     {
         return response()->json($this->data);
     }
-}
\ No newline at end of file
+}
diff --git a/app/Exceptions/UnauthorizedException.php b/app/Exceptions/UnauthorizedException.php
index 525b431c7..a13ba3a55 100644
--- a/app/Exceptions/UnauthorizedException.php
+++ b/app/Exceptions/UnauthorizedException.php
@@ -14,4 +14,4 @@ class UnauthorizedException extends Exception
     {
         parent::__construct($message, $code);
     }
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php
index 0a3d89453..f143ea5cd 100644
--- a/app/Http/Controllers/Api/ApiController.php
+++ b/app/Http/Controllers/Api/ApiController.php
@@ -27,4 +27,4 @@ abstract class ApiController extends Controller
     {
         return $this->rules;
     }
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/Api/ApiDocsController.php b/app/Http/Controllers/Api/ApiDocsController.php
index 80e86e101..c63ca698c 100644
--- a/app/Http/Controllers/Api/ApiDocsController.php
+++ b/app/Http/Controllers/Api/ApiDocsController.php
@@ -25,5 +25,4 @@ class ApiDocsController extends ApiController
         $docs = ApiDocsGenerator::generateConsideringCache();
         return response()->json($docs);
     }
-
 }
diff --git a/app/Http/Controllers/Api/BookApiController.php b/app/Http/Controllers/Api/BookApiController.php
index 1b9bddbb1..81ac9c7aa 100644
--- a/app/Http/Controllers/Api/BookApiController.php
+++ b/app/Http/Controllers/Api/BookApiController.php
@@ -91,4 +91,4 @@ class BookApiController extends ApiController
         $this->bookRepo->destroy($book);
         return response('', 204);
     }
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/Api/BookshelfApiController.php b/app/Http/Controllers/Api/BookshelfApiController.php
index 57461fce5..4ce93defa 100644
--- a/app/Http/Controllers/Api/BookshelfApiController.php
+++ b/app/Http/Controllers/Api/BookshelfApiController.php
@@ -112,4 +112,4 @@ class BookshelfApiController extends ApiController
         $this->bookshelfRepo->destroy($shelf);
         return response('', 204);
     }
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index 1252e6217..d5685644e 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -195,5 +195,4 @@ class LoginController extends Controller
 
         return redirect('/login');
     }
-
 }
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index e3d22264d..cbec1f03f 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -117,5 +117,4 @@ class RegisterController extends Controller
             'password' => Hash::make($data['password']),
         ]);
     }
-
 }
diff --git a/app/Http/Controllers/Auth/Saml2Controller.php b/app/Http/Controllers/Auth/Saml2Controller.php
index 8a3bf065e..dc7814c4b 100644
--- a/app/Http/Controllers/Auth/Saml2Controller.php
+++ b/app/Http/Controllers/Auth/Saml2Controller.php
@@ -82,5 +82,4 @@ class Saml2Controller extends Controller
 
         return redirect()->intended();
     }
-
 }
diff --git a/app/Http/Controllers/UserApiTokenController.php b/app/Http/Controllers/UserApiTokenController.php
index ab0e9069e..3949722ea 100644
--- a/app/Http/Controllers/UserApiTokenController.php
+++ b/app/Http/Controllers/UserApiTokenController.php
@@ -140,5 +140,4 @@ class UserApiTokenController extends Controller
         $token = ApiToken::query()->where('user_id', '=', $user->id)->where('id', '=', $tokenId)->firstOrFail();
         return [$user, $token];
     }
-
 }
diff --git a/app/Http/Middleware/ChecksForEmailConfirmation.php b/app/Http/Middleware/ChecksForEmailConfirmation.php
index 4b1732810..cbf55040a 100644
--- a/app/Http/Middleware/ChecksForEmailConfirmation.php
+++ b/app/Http/Middleware/ChecksForEmailConfirmation.php
@@ -33,4 +33,4 @@ trait ChecksForEmailConfirmation
 
         return false;
     }
-}
\ No newline at end of file
+}
diff --git a/app/Http/Middleware/ThrottleApiRequests.php b/app/Http/Middleware/ThrottleApiRequests.php
index d08840cd1..4e03aed58 100644
--- a/app/Http/Middleware/ThrottleApiRequests.php
+++ b/app/Http/Middleware/ThrottleApiRequests.php
@@ -14,5 +14,4 @@ class ThrottleApiRequests extends Middleware
     {
         return (int) config('api.requests_per_minute');
     }
-
-}
\ No newline at end of file
+}
diff --git a/app/Interfaces/Loggable.php b/app/Interfaces/Loggable.php
index 33e1d7c95..923f64b00 100644
--- a/app/Interfaces/Loggable.php
+++ b/app/Interfaces/Loggable.php
@@ -8,4 +8,4 @@ interface Loggable
      * Get the string descriptor for this item.
      */
     public function logDescriptor(): string;
-}
\ No newline at end of file
+}
diff --git a/app/Providers/TranslationServiceProvider.php b/app/Providers/TranslationServiceProvider.php
index 9ff607afe..b7fb9b117 100644
--- a/app/Providers/TranslationServiceProvider.php
+++ b/app/Providers/TranslationServiceProvider.php
@@ -17,5 +17,4 @@ class TranslationServiceProvider extends BaseProvider
             return new FileLoader($app['files'], $app['path.lang']);
         });
     }
-
-}
\ No newline at end of file
+}
diff --git a/app/Settings/SettingService.php b/app/Settings/SettingService.php
index feb54c30a..310e0ccff 100644
--- a/app/Settings/SettingService.php
+++ b/app/Settings/SettingService.php
@@ -176,7 +176,7 @@ class SettingService
      */
     protected function formatArrayValue(array $value): string
     {
-        $values = collect($value)->values()->filter(function(array $item) {
+        $values = collect($value)->values()->filter(function (array $item) {
             return count(array_filter($item)) > 0;
         });
         return json_encode($values);
diff --git a/app/Traits/HasCreatorAndUpdater.php b/app/Traits/HasCreatorAndUpdater.php
index ad6c3035f..ace1fa12c 100644
--- a/app/Traits/HasCreatorAndUpdater.php
+++ b/app/Traits/HasCreatorAndUpdater.php
@@ -24,5 +24,4 @@ trait HasCreatorAndUpdater
     {
         return $this->belongsTo(User::class, 'updated_by');
     }
-
 }
diff --git a/app/Traits/HasOwner.php b/app/Traits/HasOwner.php
index 9d1eb3df7..ff4b8c18e 100644
--- a/app/Traits/HasOwner.php
+++ b/app/Traits/HasOwner.php
@@ -15,5 +15,4 @@ trait HasOwner
     {
         return $this->belongsTo(User::class, 'owned_by');
     }
-
 }
diff --git a/app/Translation/FileLoader.php b/app/Translation/FileLoader.php
index f0f895da5..0b4a93de6 100644
--- a/app/Translation/FileLoader.php
+++ b/app/Translation/FileLoader.php
@@ -27,4 +27,4 @@ class FileLoader extends BaseLoader
 
         return $this->loadNamespaced($locale, $group, $namespace);
     }
-}
\ No newline at end of file
+}
diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.php
index b4d743b73..112ac6727 100644
--- a/app/Uploads/ImageRepo.php
+++ b/app/Uploads/ImageRepo.php
@@ -70,8 +70,7 @@ class ImageRepo
         int $uploadedTo = null,
         string $search = null,
         callable $whereClause = null
-    ): array
-    {
+    ): array {
         $imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type));
 
         if ($uploadedTo !== null) {
@@ -102,8 +101,7 @@ class ImageRepo
         int $pageSize = 24,
         int $uploadedTo = null,
         string $search = null
-    ): array
-    {
+    ): array {
         $contextPage = $this->page->findOrFail($uploadedTo);
         $parentFilter = null;
 
diff --git a/app/Uploads/UserAvatars.php b/app/Uploads/UserAvatars.php
index b3b9d5951..f1509bbb8 100644
--- a/app/Uploads/UserAvatars.php
+++ b/app/Uploads/UserAvatars.php
@@ -97,5 +97,4 @@ class UserAvatars
 
         return $url;
     }
-
-}
\ No newline at end of file
+}
diff --git a/phpcs.xml b/phpcs.xml
index ccde28033..8d5157d9e 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,9 +1,12 @@
 <?xml version="1.0"?>
-<ruleset name="PHP_CodeSniffer">
+<ruleset name="BookStack Standard">
+    <!--    Format described at: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset   -->
     <description>The coding standard for BookStack.</description>
-    <file>app</file>
+    <config name="php_version" value="70205"/>
+    <file>./app</file>
     <exclude-pattern>*/migrations/*</exclude-pattern>
     <exclude-pattern>*/tests/*</exclude-pattern>
     <arg value="np"/>
+    <arg name="colors"/>
     <rule ref="PSR2"/>
 </ruleset>
\ No newline at end of file