mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-01 14:04:30 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
6caf605fe2
commit
e01b06fb85
80 changed files with 173 additions and 218 deletions
|
@ -331,7 +331,8 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
$old_data = $this->filterFieldRestrictions($entity, $old_data);
|
||||
|
||||
//Restrict length of string fields, to save memory...
|
||||
$old_data = array_map(function ($value) {
|
||||
$old_data = array_map(
|
||||
static function ($value) {
|
||||
if (is_string($value)) {
|
||||
return mb_strimwidth($value, 0, self::MAX_STRING_LENGTH, '...');
|
||||
}
|
||||
|
@ -350,10 +351,6 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
protected function validEntity(object $entity): bool
|
||||
{
|
||||
//Dont log logentries itself!
|
||||
if ($entity instanceof AbstractDBElement && !$entity instanceof AbstractLogEntry) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $entity instanceof AbstractDBElement && !$entity instanceof AbstractLogEntry;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
|||
$this->eventLogger = $eventLogger;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
SecurityEvents::U2F_ADDED => 'u2f_added',
|
||||
|
|
|
@ -71,7 +71,7 @@ final class SetMailFromSubscriber implements EventSubscriberInterface
|
|||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
// should be the last one to allow header changes by other listeners first
|
||||
|
|
|
@ -75,7 +75,7 @@ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
|||
*
|
||||
* @return array The event names to listen to
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['kernel.response' => 'onKernelResponse'];
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ final class LoginSuccessSubscriber implements EventSubscriberInterface
|
|||
*
|
||||
* @return array The event names to listen to
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [SecurityEvents::INTERACTIVE_LOGIN => 'onLogin'];
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ final class LogoutDisabledUserSubscriber implements EventSubscriberInterface
|
|||
*
|
||||
* @return array The event names to listen to
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [KernelEvents::REQUEST => 'onRequest'];
|
||||
}
|
||||
|
|
|
@ -147,14 +147,10 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
|||
{
|
||||
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
|
||||
|
||||
if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => 'redirectToSettingsIfNeeded',
|
||||
|
|
|
@ -101,7 +101,7 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
|
|||
*
|
||||
* @return array The event names to listen to
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
//Set the timezone shortly before executing the controller
|
||||
return [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue