NOW MANAGED ON CODEBERG
Ran phpcbf and updated phpcs.xml
Dan Brown98a1e57ba907
diff --git a/app/Actions/Activity.php b/app/Actions/Activity.phpindex 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.phpindex 216f61249..ec02bed25 100644--- a/app/Actions/ActivityType.php+++ b/app/Actions/ActivityType.php@@ -48,4 +48,4 @@ class ActivityTypeconst 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.phpindex 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.phpindex 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.phpindex 9a0c691c8..b133754d8 100644--- a/app/Auth/Access/Guards/ExternalBaseSessionGuard.php+++ b/app/Auth/Access/Guards/ExternalBaseSessionGuard.php@@ -299,5 +299,4 @@ class ExternalBaseSessionGuard implements StatefulGuardreturn $this;}-}diff --git a/app/Auth/Access/Guards/LdapSessionGuard.php b/app/Auth/Access/Guards/LdapSessionGuard.phpindex 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 ExternalBaseSessionGuardreturn $this->registrationService->registerUser($details, null, false);}-}diff --git a/app/Auth/Access/Guards/Saml2SessionGuard.php b/app/Auth/Access/Guards/Saml2SessionGuard.phpindex 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.phpindex 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 RegistrationServicethrow 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.phpindex 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.phpindex 4371fb84c..7de95c263 100644--- a/app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php+++ b/app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php@@ -21,4 +21,4 @@ class CustomStrikethroughRenderer implements InlineRendererInterfacereturn 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.phpindex 60e3a9b78..6c03c57a6 100644--- a/app/Entities/Tools/SearchOptions.php+++ b/app/Entities/Tools/SearchOptions.php@@ -137,5 +137,4 @@ class SearchOptionsreturn $string;}--}\ No newline at end of file+}diff --git a/app/Exceptions/ApiAuthException.php b/app/Exceptions/ApiAuthException.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 1252e6217..d5685644e 100644--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@ -195,5 +195,4 @@ class LoginController extends Controllerreturn redirect('/login');}-}diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.phpindex 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.phpindex 8a3bf065e..dc7814c4b 100644--- a/app/Http/Controllers/Auth/Saml2Controller.php+++ b/app/Http/Controllers/Auth/Saml2Controller.php@@ -82,5 +82,4 @@ class Saml2Controller extends Controllerreturn redirect()->intended();}-}diff --git a/app/Http/Controllers/UserApiTokenController.php b/app/Http/Controllers/UserApiTokenController.phpindex 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.phpindex 4b1732810..cbf55040a 100644--- a/app/Http/Middleware/ChecksForEmailConfirmation.php+++ b/app/Http/Middleware/ChecksForEmailConfirmation.php@@ -33,4 +33,4 @@ trait ChecksForEmailConfirmationreturn false;}-}\ No newline at end of file+}diff --git a/app/Http/Middleware/ThrottleApiRequests.php b/app/Http/Middleware/ThrottleApiRequests.phpindex 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.phpindex 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.phpindex 9ff607afe..b7fb9b117 100644--- a/app/Providers/TranslationServiceProvider.php+++ b/app/Providers/TranslationServiceProvider.php@@ -17,5 +17,4 @@ class TranslationServiceProvider extends BaseProviderreturn new FileLoader($app['files'], $app['path.lang']);});}--}\ No newline at end of file+}diff --git a/app/Settings/SettingService.php b/app/Settings/SettingService.phpindex 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.phpindex 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.phpindex 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.phpindex f0f895da5..0b4a93de6 100644--- a/app/Translation/FileLoader.php+++ b/app/Translation/FileLoader.php@@ -27,4 +27,4 @@ class FileLoader extends BaseLoaderreturn $this->loadNamespaced($locale, $group, $namespace);}-}\ No newline at end of file+}diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.phpindex b4d743b73..112ac6727 100644--- a/app/Uploads/ImageRepo.php+++ b/app/Uploads/ImageRepo.php@@ -70,8 +70,7 @@ class ImageRepoint $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 ImageRepoint $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.phpindex b3b9d5951..f1509bbb8 100644--- a/app/Uploads/UserAvatars.php+++ b/app/Uploads/UserAvatars.php@@ -97,5 +97,4 @@ class UserAvatarsreturn $url;}--}\ No newline at end of file+}diff --git a/phpcs.xml b/phpcs.xmlindex 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