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

@ -63,7 +63,7 @@ class PasswordResetManager
$expiration_date->add(date_interval_create_from_date_string('1 day'));
$user->setPwResetExpires($expiration_date);
if (!empty($user->getEmail())) {
if ($user->getEmail() !== null && $user->getEmail() !== '') {
$address = new Address($user->getEmail(), $user->getFullName());
$mail = new TemplatedEmail();
$mail->to($address);

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\Services\UserSystem;
use App\Entity\UserSystem\PermissionData;
@ -181,4 +183,4 @@ class PermissionPresetsHelper
$this->permissionResolver->setAllPermissions($perm_holder, PermissionData::ALLOW);
return $perm_holder;
}
}
}

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\Services\UserSystem;
use App\Entity\UserSystem\Group;
@ -138,4 +140,4 @@ class PermissionSchemaUpdater
$holder->getPermissions()->removePermission('devices');
}
}
}
}

View file

@ -40,7 +40,7 @@ class BackupCodeManager
*/
public function enableBackupCodes(User $user): void
{
if (empty($user->getBackupCodes())) {
if ($user->getBackupCodes() === []) {
$this->regenerateBackupCodes($user);
}
}

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\Services\UserSystem;
use Imagine\Exception\RuntimeException;
@ -115,7 +117,7 @@ class UserAvatarHelper
private function getGravatar(User $user, int $s = 80, string $d = 'identicon', string $r = 'g'): string
{
$email = $user->getEmail();
if (empty($email)) {
if ($email === null || $email === '') {
$email = 'Part-DB';
}
@ -161,4 +163,4 @@ class UserAvatarHelper
return $attachment;
}
}
}