]> BookStack Code Mirror - bookstack/commitdiff
Ran phpcbf and updated phpcs.xml
authorDan Brown <redacted>
Sun, 7 Mar 2021 22:24:05 +0000 (22:24 +0000)
committerDan Brown <redacted>
Sun, 7 Mar 2021 22:24:05 +0000 (22:24 +0000)
33 files changed:
app/Actions/Activity.php
app/Actions/ActivityType.php
app/Api/ApiDocsGenerator.php
app/Api/ApiTokenGuard.php
app/Auth/Access/Guards/ExternalBaseSessionGuard.php
app/Auth/Access/Guards/LdapSessionGuard.php
app/Auth/Access/Guards/Saml2SessionGuard.php
app/Auth/Access/RegistrationService.php
app/Entities/Tools/Markdown/CustomStrikeThroughExtension.php
app/Entities/Tools/Markdown/CustomStrikethroughRenderer.php
app/Entities/Tools/SearchOptions.php
app/Exceptions/ApiAuthException.php
app/Exceptions/JsonDebugException.php
app/Exceptions/UnauthorizedException.php
app/Http/Controllers/Api/ApiController.php
app/Http/Controllers/Api/ApiDocsController.php
app/Http/Controllers/Api/BookApiController.php
app/Http/Controllers/Api/BookshelfApiController.php
app/Http/Controllers/Auth/LoginController.php
app/Http/Controllers/Auth/RegisterController.php
app/Http/Controllers/Auth/Saml2Controller.php
app/Http/Controllers/UserApiTokenController.php
app/Http/Middleware/ChecksForEmailConfirmation.php
app/Http/Middleware/ThrottleApiRequests.php
app/Interfaces/Loggable.php
app/Providers/TranslationServiceProvider.php
app/Settings/SettingService.php
app/Traits/HasCreatorAndUpdater.php
app/Traits/HasOwner.php
app/Translation/FileLoader.php
app/Uploads/ImageRepo.php
app/Uploads/UserAvatars.php
phpcs.xml

index 9d256c9b2918b2cdf0d7f543662bd7a7fb920f87..c8590f0b25d12dc8f4f29210e51cd3c8b28de897 100644 (file)
@@ -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;
index 216f612499ba3145c9584e0dc9dd77a173946a1c..ec02bed25483696747c9fceceb6f9b560e4da819 100644 (file)
@@ -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
+}
index 2953647bb33b21d59f565ce990cffecfc7a8beea..8b520eda2b7432e67c49228e73a349495993fa83 100644 (file)
@@ -142,5 +142,4 @@ class ApiDocsGenerator
             ];
         });
     }
-
-}
\ No newline at end of file
+}
index e0a50ebe3d2a03f7e90a8b4362ff15283bb73849..59ab72f4eb8509be037704fdddff907bda4403b4 100644 (file)
@@ -163,4 +163,4 @@ class ApiTokenGuard implements Guard
     {
         $this->user = null;
     }
-}
\ No newline at end of file
+}
index 9a0c691c8bbb272301c45bccbf6b7c3739554f84..b133754d8e932f43c750ab40b35fab224904d107 100644 (file)
@@ -299,5 +299,4 @@ class ExternalBaseSessionGuard implements StatefulGuard
 
         return $this;
     }
-
 }
index 652141c0ce280963abc337f20cd62e19d79e6f40..d761a30e66b366b66be41b204b1d08223824ff22 100644 (file)
@@ -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);
     }
-
 }
index 68683bb4368b61ac23769fdce2eeb1ed7e876497..044c2f3833f3b2f4652bf22c210c775efbc1b583 100644 (file)
@@ -34,5 +34,4 @@ class Saml2SessionGuard extends ExternalBaseSessionGuard
     {
         return false;
     }
-
 }
index 2aff6c37d5140c84644f75077cceea2cd25d43d1..9070d12415543410fff1cc3fa275a15af867f27c 100644 (file)
@@ -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
+}
index cb8b0ffc2d2a5eda26636d95fbd106b8789a78c2..d4984ef081dd4965e23e697a7ced6dace0e67c37 100644 (file)
@@ -13,4 +13,4 @@ class CustomStrikeThroughExtension implements ExtensionInterface
         $environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor());
         $environment->addInlineRenderer(Strikethrough::class, new CustomStrikethroughRenderer());
     }
-}
\ No newline at end of file
+}
index 4371fb84ce8292a18d844d44d439f6729f0a6cb0..7de95c2637b057ecfcaca84864e3b84f4b873270 100644 (file)
@@ -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
+}
index 60e3a9b7876d971edd29c681643ec58a0fbab09d..6c03c57a6105ce7a36e4c311e2b2f75ba3b13149 100644 (file)
@@ -137,5 +137,4 @@ class SearchOptions
 
         return $string;
     }
-
-}
\ No newline at end of file
+}
index cc68ba8cf424c31c4f741e11aea34f9f50177a4e..36ea8be9de5dc8b2bbe3232483b25c3da68ad491 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace BookStack\Exceptions;
 
-class ApiAuthException extends UnauthorizedException {
+class ApiAuthException extends UnauthorizedException
+{
 
-}
\ No newline at end of file
+}
index 6314533ce11d2fdf0afab4c11131ea4f5af2e68a..e155579d601366292cdc88e5e7ae106c4e38949f 100644 (file)
@@ -22,4 +22,4 @@ class JsonDebugException extends Exception
     {
         return response()->json($this->data);
     }
-}
\ No newline at end of file
+}
index 525b431c7b45de7538e37526f31cf5f4cd9764de..a13ba3a55d807033b7b79a19d8684396a4649d7c 100644 (file)
@@ -14,4 +14,4 @@ class UnauthorizedException extends Exception
     {
         parent::__construct($message, $code);
     }
-}
\ No newline at end of file
+}
index 0a3d8945356cb9414fc592fb3c4f7668c272e4b7..f143ea5cd50a3d33f9a66ae58464a71b8bf9066c 100644 (file)
@@ -27,4 +27,4 @@ abstract class ApiController extends Controller
     {
         return $this->rules;
     }
-}
\ No newline at end of file
+}
index 80e86e101038f475da2e9f19a6821f7cab27b462..c63ca698cc53808edad9c279f7066af417fcad39 100644 (file)
@@ -25,5 +25,4 @@ class ApiDocsController extends ApiController
         $docs = ApiDocsGenerator::generateConsideringCache();
         return response()->json($docs);
     }
-
 }
index 1b9bddbb166321d33c7ae4c65dd931f46141365b..81ac9c7aa6c56e44bd2551e379d37e1f75ec5882 100644 (file)
@@ -91,4 +91,4 @@ class BookApiController extends ApiController
         $this->bookRepo->destroy($book);
         return response('', 204);
     }
-}
\ No newline at end of file
+}
index 57461fce55c9ce71e38d058524d5ec87fbe00ac5..4ce93defa9e152d7b7837cae05618277fccab0ba 100644 (file)
@@ -112,4 +112,4 @@ class BookshelfApiController extends ApiController
         $this->bookshelfRepo->destroy($shelf);
         return response('', 204);
     }
-}
\ No newline at end of file
+}
index 1252e6217a8b66f1bda3b405af28085a177308de..d5685644ea5c32f80076feb3a5529bc27c563fbc 100644 (file)
@@ -195,5 +195,4 @@ class LoginController extends Controller
 
         return redirect('/login');
     }
-
 }
index e3d22264d5301a73c2d2bee41daa1c71209512a9..cbec1f03f6e3b0b58704b17de79e21f8bf975a8c 100644 (file)
@@ -117,5 +117,4 @@ class RegisterController extends Controller
             'password' => Hash::make($data['password']),
         ]);
     }
-
 }
index 8a3bf065ed566b55062a184c76c7144797417060..dc7814c4b173055bdb07c5c4a0e298249c113e65 100644 (file)
@@ -82,5 +82,4 @@ class Saml2Controller extends Controller
 
         return redirect()->intended();
     }
-
 }
index ab0e9069e7c2db27fd310308d39c2be6bc14d537..3949722ead098b1d7c7e0b82dc8ca02a27a73eb3 100644 (file)
@@ -140,5 +140,4 @@ class UserApiTokenController extends Controller
         $token = ApiToken::query()->where('user_id', '=', $user->id)->where('id', '=', $tokenId)->firstOrFail();
         return [$user, $token];
     }
-
 }
index 4b1732810d79fc6c4dcdd2b39949354f535660ac..cbf55040a5bbeba8cb0bf8b3c9dc6fef48fe2e12 100644 (file)
@@ -33,4 +33,4 @@ trait ChecksForEmailConfirmation
 
         return false;
     }
-}
\ No newline at end of file
+}
index d08840cd1f857415e76a2496b200c22873c30d9f..4e03aed58d50113236f5fef509a89c43101efa8b 100644 (file)
@@ -14,5 +14,4 @@ class ThrottleApiRequests extends Middleware
     {
         return (int) config('api.requests_per_minute');
     }
-
-}
\ No newline at end of file
+}
index 33e1d7c95ad1299d7b671a10edff08658300ebdc..923f64b00359c571134eabeead93f6509a110254 100644 (file)
@@ -8,4 +8,4 @@ interface Loggable
      * Get the string descriptor for this item.
      */
     public function logDescriptor(): string;
-}
\ No newline at end of file
+}
index 9ff607afe914a8bc0d6c2e6fea620a2bba092f90..b7fb9b117ac18896cbd8cebcc54c08d21350a563 100644 (file)
@@ -17,5 +17,4 @@ class TranslationServiceProvider extends BaseProvider
             return new FileLoader($app['files'], $app['path.lang']);
         });
     }
-
-}
\ No newline at end of file
+}
index feb54c30a6d95d82d5eb28b195d05da47180acdd..310e0ccfff83d2898cb6b675d5924da233c4a0f0 100644 (file)
@@ -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);
index ad6c3035fe2a743845b84c2d36ad42a4508b5446..ace1fa12cb47781550afa38a682b1b4bf12fc2eb 100644 (file)
@@ -24,5 +24,4 @@ trait HasCreatorAndUpdater
     {
         return $this->belongsTo(User::class, 'updated_by');
     }
-
 }
index 9d1eb3df79d23bbb54d4e970ee5b2bc29e6c5167..ff4b8c18ec9d1b9e4bb43b24cdea1c09f29446f5 100644 (file)
@@ -15,5 +15,4 @@ trait HasOwner
     {
         return $this->belongsTo(User::class, 'owned_by');
     }
-
 }
index f0f895da55c05ca8598a5d8f9bc6eb39d13b44b0..0b4a93de6bc8dc84b9145378a2830f2645160c88 100644 (file)
@@ -27,4 +27,4 @@ class FileLoader extends BaseLoader
 
         return $this->loadNamespaced($locale, $group, $namespace);
     }
-}
\ No newline at end of file
+}
index b4d743b73447a2cc99dade9b367f78e489020279..112ac6727e164b795021bbfb61ca987a15c9a31e 100644 (file)
@@ -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;
 
index b3b9d59515c336ac85893684ec5007167099112a..f1509bbb8079b163f9ce15b035adf430622a8fc9 100644 (file)
@@ -97,5 +97,4 @@ class UserAvatars
 
         return $url;
     }
-
-}
\ No newline at end of file
+}
index ccde28033ab9a3675dbf0203c073e09c01108925..8d5157d9ea41d60c046dd538400308c8faabe0d3 100644 (file)
--- 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