Added declare strict types to all files

This commit is contained in:
Jan Böhmer 2023-06-11 18:59:07 +02:00
parent bea90a7d94
commit 6a2ff9d153
196 changed files with 685 additions and 360 deletions

View file

@ -146,7 +146,7 @@ class EventLoggerSubscriber implements EventSubscriber
$uow = $em->getUnitOfWork();
// If we have added any ElementCreatedLogEntries added in postPersist, we flush them here.
$uow->computeChangeSets();
if ($uow->hasPendingInsertions() || !empty($uow->getScheduledEntityUpdates())) {
if ($uow->hasPendingInsertions() || $uow->getScheduledEntityUpdates() !== []) {
$em->flush();
}

View file

@ -55,8 +55,8 @@ class LogDBMigrationSubscriber implements EventSubscriber
$this->new_version = (string) $aliasResolver->resolveVersionAlias('current');
//After everything is done, write the results to DB log
$this->old_version = empty($this->old_version) ? 'legacy/empty' : $this->old_version;
$this->new_version = empty($this->new_version) ? 'unknown' : $this->new_version;
$this->old_version = $this->old_version === null || $this->old_version === '' ? 'legacy/empty' : $this->old_version;
$this->new_version = $this->new_version === '' ? 'unknown' : $this->new_version;
try {
$log = new DatabaseUpdatedLogEntry($this->old_version, $this->new_version);

View file

@ -43,12 +43,12 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
//Check if the user has set a timezone
$user = $this->security->getUser();
if ($user instanceof User && !empty($user->getTimezone())) {
if ($user instanceof User && ($user->getTimezone() !== null && $user->getTimezone() !== '')) {
$timezone = $user->getTimezone();
}
//Fill with default value if needed
if (null === $timezone && !empty($this->default_timezone)) {
if (null === $timezone && $this->default_timezone !== '') {
$timezone = $this->default_timezone;
}

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\EventSubscriber\UserSystem;
use Symfony\Bundle\SecurityBundle\Security;
@ -68,4 +70,4 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
{
return [KernelEvents::REQUEST => 'onRequest'];
}
}
}