Ran phpcbf and updated phpcs.xml

This commit is contained in:
Dan Brown 2021-03-07 22:24:05 +00:00
parent 9a3e1490ff
commit 98a1e57ba9
33 changed files with 34 additions and 48 deletions

View File

@ -6,6 +6,7 @@ use BookStack\Auth\User;
use BookStack\Entities\Models\Entity; use BookStack\Entities\Models\Entity;
use BookStack\Model; use BookStack\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Str; use Illuminate\Support\Str;
/** /**
@ -23,7 +24,7 @@ class Activity extends Model
/** /**
* Get the entity for this activity. * Get the entity for this activity.
*/ */
public function entity() public function entity(): MorphTo
{ {
if ($this->entity_type === '') { if ($this->entity_type === '') {
$this->entity_type = null; $this->entity_type = null;

View File

@ -48,4 +48,4 @@ class ActivityType
const AUTH_PASSWORD_RESET_UPDATE = 'auth_password_reset_update'; const AUTH_PASSWORD_RESET_UPDATE = 'auth_password_reset_update';
const AUTH_LOGIN = 'auth_login'; const AUTH_LOGIN = 'auth_login';
const AUTH_REGISTER = 'auth_register'; const AUTH_REGISTER = 'auth_register';
} }

View File

@ -142,5 +142,4 @@ class ApiDocsGenerator
]; ];
}); });
} }
}
}

View File

@ -163,4 +163,4 @@ class ApiTokenGuard implements Guard
{ {
$this->user = null; $this->user = null;
} }
} }

View File

@ -299,5 +299,4 @@ class ExternalBaseSessionGuard implements StatefulGuard
return $this; return $this;
} }
} }

View File

@ -23,13 +23,13 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
/** /**
* LdapSessionGuard constructor. * LdapSessionGuard constructor.
*/ */
public function __construct($name, public function __construct(
$name,
UserProvider $provider, UserProvider $provider,
Session $session, Session $session,
LdapService $ldapService, LdapService $ldapService,
RegistrationService $registrationService RegistrationService $registrationService
) ) {
{
$this->ldapService = $ldapService; $this->ldapService = $ldapService;
parent::__construct($name, $provider, $session, $registrationService); parent::__construct($name, $provider, $session, $registrationService);
} }
@ -119,5 +119,4 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
return $this->registrationService->registerUser($details, null, false); return $this->registrationService->registerUser($details, null, false);
} }
} }

View File

@ -34,5 +34,4 @@ class Saml2SessionGuard extends ExternalBaseSessionGuard
{ {
return false; return false;
} }
} }

View File

@ -83,7 +83,6 @@ class RegistrationService
$message = trans('auth.email_confirm_send_error'); $message = trans('auth.email_confirm_send_error');
throw new UserRegistrationException($message, '/register/confirm'); throw new UserRegistrationException($message, '/register/confirm');
} }
} }
return $newUser; return $newUser;
@ -109,5 +108,4 @@ class RegistrationService
throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), $redirect); throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), $redirect);
} }
} }
}
}

View File

@ -13,4 +13,4 @@ class CustomStrikeThroughExtension implements ExtensionInterface
$environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor()); $environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor());
$environment->addInlineRenderer(Strikethrough::class, new CustomStrikethroughRenderer()); $environment->addInlineRenderer(Strikethrough::class, new CustomStrikethroughRenderer());
} }
} }

View File

@ -21,4 +21,4 @@ class CustomStrikethroughRenderer implements InlineRendererInterface
return new HtmlElement('s', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children())); return new HtmlElement('s', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children()));
} }
} }

View File

@ -137,5 +137,4 @@ class SearchOptions
return $string; return $string;
} }
}
}

View File

@ -2,6 +2,7 @@
namespace BookStack\Exceptions; namespace BookStack\Exceptions;
class ApiAuthException extends UnauthorizedException { class ApiAuthException extends UnauthorizedException
{
} }

View File

@ -22,4 +22,4 @@ class JsonDebugException extends Exception
{ {
return response()->json($this->data); return response()->json($this->data);
} }
} }

View File

@ -14,4 +14,4 @@ class UnauthorizedException extends Exception
{ {
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }

View File

@ -27,4 +27,4 @@ abstract class ApiController extends Controller
{ {
return $this->rules; return $this->rules;
} }
} }

View File

@ -25,5 +25,4 @@ class ApiDocsController extends ApiController
$docs = ApiDocsGenerator::generateConsideringCache(); $docs = ApiDocsGenerator::generateConsideringCache();
return response()->json($docs); return response()->json($docs);
} }
} }

View File

@ -91,4 +91,4 @@ class BookApiController extends ApiController
$this->bookRepo->destroy($book); $this->bookRepo->destroy($book);
return response('', 204); return response('', 204);
} }
} }

View File

@ -112,4 +112,4 @@ class BookshelfApiController extends ApiController
$this->bookshelfRepo->destroy($shelf); $this->bookshelfRepo->destroy($shelf);
return response('', 204); return response('', 204);
} }
} }

View File

@ -195,5 +195,4 @@ class LoginController extends Controller
return redirect('/login'); return redirect('/login');
} }
} }

View File

@ -117,5 +117,4 @@ class RegisterController extends Controller
'password' => Hash::make($data['password']), 'password' => Hash::make($data['password']),
]); ]);
} }
} }

View File

@ -82,5 +82,4 @@ class Saml2Controller extends Controller
return redirect()->intended(); return redirect()->intended();
} }
} }

View File

@ -140,5 +140,4 @@ class UserApiTokenController extends Controller
$token = ApiToken::query()->where('user_id', '=', $user->id)->where('id', '=', $tokenId)->firstOrFail(); $token = ApiToken::query()->where('user_id', '=', $user->id)->where('id', '=', $tokenId)->firstOrFail();
return [$user, $token]; return [$user, $token];
} }
} }

View File

@ -33,4 +33,4 @@ trait ChecksForEmailConfirmation
return false; return false;
} }
} }

View File

@ -14,5 +14,4 @@ class ThrottleApiRequests extends Middleware
{ {
return (int) config('api.requests_per_minute'); return (int) config('api.requests_per_minute');
} }
}
}

View File

@ -8,4 +8,4 @@ interface Loggable
* Get the string descriptor for this item. * Get the string descriptor for this item.
*/ */
public function logDescriptor(): string; public function logDescriptor(): string;
} }

View File

@ -17,5 +17,4 @@ class TranslationServiceProvider extends BaseProvider
return new FileLoader($app['files'], $app['path.lang']); return new FileLoader($app['files'], $app['path.lang']);
}); });
} }
}
}

View File

@ -176,7 +176,7 @@ class SettingService
*/ */
protected function formatArrayValue(array $value): string 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 count(array_filter($item)) > 0;
}); });
return json_encode($values); return json_encode($values);

View File

@ -24,5 +24,4 @@ trait HasCreatorAndUpdater
{ {
return $this->belongsTo(User::class, 'updated_by'); return $this->belongsTo(User::class, 'updated_by');
} }
} }

View File

@ -15,5 +15,4 @@ trait HasOwner
{ {
return $this->belongsTo(User::class, 'owned_by'); return $this->belongsTo(User::class, 'owned_by');
} }
} }

View File

@ -27,4 +27,4 @@ class FileLoader extends BaseLoader
return $this->loadNamespaced($locale, $group, $namespace); return $this->loadNamespaced($locale, $group, $namespace);
} }
} }

View File

@ -70,8 +70,7 @@ class ImageRepo
int $uploadedTo = null, int $uploadedTo = null,
string $search = null, string $search = null,
callable $whereClause = null callable $whereClause = null
): array ): array {
{
$imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type)); $imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type));
if ($uploadedTo !== null) { if ($uploadedTo !== null) {
@ -102,8 +101,7 @@ class ImageRepo
int $pageSize = 24, int $pageSize = 24,
int $uploadedTo = null, int $uploadedTo = null,
string $search = null string $search = null
): array ): array {
{
$contextPage = $this->page->findOrFail($uploadedTo); $contextPage = $this->page->findOrFail($uploadedTo);
$parentFilter = null; $parentFilter = null;

View File

@ -97,5 +97,4 @@ class UserAvatars
return $url; return $url;
} }
}
}

View File

@ -1,9 +1,12 @@
<?xml version="1.0"?> <?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> <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>*/migrations/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern> <exclude-pattern>*/tests/*</exclude-pattern>
<arg value="np"/> <arg value="np"/>
<arg name="colors"/>
<rule ref="PSR2"/> <rule ref="PSR2"/>
</ruleset> </ruleset>