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

@ -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\Controller;
use App\Entity\Parts\Part;
@ -121,4 +123,4 @@ class PartImportExportController extends AbstractController
return $entityExporter->exportEntityFromRequest($parts, $request);
}
}
}

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\Controller;
use App\DataTables\ProjectBomEntriesDataTable;
@ -262,4 +264,4 @@ class ProjectController extends AbstractController
'form' => $form,
]);
}
}
}

View file

@ -50,7 +50,7 @@ class RedirectController extends AbstractController
//Check if a user has set a preferred language setting:
$user = $this->getUser();
if (($user instanceof User) && !empty($user->getLanguage())) {
if (($user instanceof User) && ($user->getLanguage() !== null && $user->getLanguage() !== '')) {
$locale = $user->getLanguage();
}

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\Controller;
use App\Entity\Base\AbstractNamedDBElement;

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\Controller;
use App\Services\Attachments\AttachmentPathResolver;

View file

@ -81,7 +81,7 @@ class UserSettingsController extends AbstractController
throw new RuntimeException('You can not remove U2F keys from SAML users!');
}
if (empty($user->getBackupCodes())) {
if ($user->getBackupCodes() === []) {
$this->addFlash('error', 'tfa_backup.no_codes_enabled');
throw new RuntimeException('You do not have any backup codes enabled, therefore you can not view them!');
@ -361,7 +361,7 @@ class UserSettingsController extends AbstractController
'attr' => [
'class' => 'btn-danger',
],
'disabled' => empty($user->getBackupCodes()),
'disabled' => $user->getBackupCodes() === [],
])->getForm();
$backup_form->handleRequest($request);

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\Controller;
use App\Entity\UserSystem\User;
@ -95,4 +97,4 @@ class WebauthnKeyRegistrationController extends AbstractController
]
);
}
}
}