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

@ -2,15 +2,17 @@
declare(strict_types=1); declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig; use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList; use Rector\Doctrine\Set\DoctrineSetList;
use Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList; use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList; use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList; use Rector\Symfony\Set\SymfonySetList;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
return static function (RectorConfig $rectorConfig): void { return static function (RectorConfig $rectorConfig): void {
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'); $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml');
@ -31,6 +33,10 @@ return static function (RectorConfig $rectorConfig): void {
// register a single rule // register a single rule
//$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); //$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->rules([
DeclareStrictTypesRector::class,
]);
// define sets of rules // define sets of rules
$rectorConfig->sets([ $rectorConfig->sets([
//PHP rules //PHP rules
@ -49,4 +55,9 @@ return static function (RectorConfig $rectorConfig): void {
PHPUnitLevelSetList::UP_TO_PHPUNIT_90, PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
PHPUnitSetList::PHPUNIT_CODE_QUALITY, PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]); ]);
$rectorConfig->skip([
AddDoesNotPerformAssertionToNonAssertingTestRector::class,
CountArrayToEmptyArrayComparisonRector::class,
]);
}; };

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace App\Command; namespace App\Command;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command; namespace App\Command;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -187,4 +189,4 @@ class CheckRequirementsCommand extends Command
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command\Migrations; namespace App\Command\Migrations;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -141,4 +143,4 @@ class ImportPartKeeprCommand extends Command
$io->success('Imported '.$count.' parts.'); $io->success('Imported '.$count.' parts.');
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command\User; namespace App\Command\User;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -105,4 +107,4 @@ class ConvertToSAMLUserCommand extends Command
return 0; return 0;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command\User; namespace App\Command\User;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command\User; namespace App\Command\User;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -99,4 +101,4 @@ class UserEnableCommand extends Command
return self::SUCCESS; return self::SUCCESS;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command\User; namespace App\Command\User;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -93,4 +95,4 @@ class UserListCommand extends Command
return self::SUCCESS; return self::SUCCESS;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command\User; namespace App\Command\User;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Command; namespace App\Command;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
@ -60,4 +62,4 @@ class VersionCommand extends Command
return Command::SUCCESS; return Command::SUCCESS;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Controller; namespace App\Controller;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
@ -121,4 +123,4 @@ class PartImportExportController extends AbstractController
return $entityExporter->exportEntityFromRequest($parts, $request); return $entityExporter->exportEntityFromRequest($parts, $request);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Controller; namespace App\Controller;
use App\DataTables\ProjectBomEntriesDataTable; use App\DataTables\ProjectBomEntriesDataTable;
@ -262,4 +264,4 @@ class ProjectController extends AbstractController
'form' => $form, 'form' => $form,
]); ]);
} }
} }

View file

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

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/** /**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Controller; namespace App\Controller;
use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractNamedDBElement;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Controller; namespace App\Controller;
use App\Services\Attachments\AttachmentPathResolver; 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!'); 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'); $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!'); 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' => [ 'attr' => [
'class' => 'btn-danger', 'class' => 'btn-danger',
], ],
'disabled' => empty($user->getBackupCodes()), 'disabled' => $user->getBackupCodes() === [],
])->getForm(); ])->getForm();
$backup_form->handleRequest($request); $backup_form->handleRequest($request);

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Controller; namespace App\Controller;
use App\Entity\UserSystem\User; use App\Entity\UserSystem\User;
@ -95,4 +97,4 @@ class WebauthnKeyRegistrationController extends AbstractController
] ]
); );
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Adapters; namespace App\DataTables\Adapters;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -50,4 +52,4 @@ class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter
return $paginator->count(); return $paginator->count();
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Column; namespace App\DataTables\Column;
use Omines\DataTablesBundle\Column\AbstractColumn; use Omines\DataTablesBundle\Column\AbstractColumn;
@ -60,4 +62,4 @@ class PrettyBoolColumn extends AbstractColumn
throw new \RuntimeException('Unexpected value!'); throw new \RuntimeException('Unexpected value!');
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Column; namespace App\DataTables\Column;
use Omines\DataTablesBundle\Column\AbstractColumn; use Omines\DataTablesBundle\Column\AbstractColumn;
@ -55,4 +57,4 @@ class RowClassColumn extends AbstractColumn
{ {
return $value; return $value;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Column; namespace App\DataTables\Column;
use App\Services\Formatters\SIFormatter; use App\Services\Formatters\SIFormatter;
@ -49,4 +51,4 @@ class SIUnitNumberColumn extends AbstractColumn
return htmlspecialchars($this->formatter->format((float) $value, $this->options['unit'], $this->options['precision'])); return htmlspecialchars($this->formatter->format((float) $value, $this->options['unit'], $this->options['precision']));
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Column; namespace App\DataTables\Column;
use Omines\DataTablesBundle\Column\AbstractColumn; use Omines\DataTablesBundle\Column\AbstractColumn;
@ -56,4 +58,4 @@ class SelectColumn extends AbstractColumn
//Return empty string, as it this column is filled by datatables on client side //Return empty string, as it this column is filled by datatables on client side
return ''; return '';
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables; namespace App\DataTables;
use App\DataTables\Column\RowClassColumn; use App\DataTables\Column\RowClassColumn;
@ -78,4 +80,4 @@ class ErrorDataTable implements DataTableTypeInterface
$error_table->handleRequest($request); $error_table->handleRequest($request);
return $error_table->getResponse(); return $error_table->getResponse();
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters; namespace App\DataTables\Filters;
use App\DataTables\Filters\Constraints\BooleanConstraint; use App\DataTables\Filters\Constraints\BooleanConstraint;
@ -102,4 +104,4 @@ class AttachmentFilter implements FilterInterface
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters; namespace App\DataTables\Filters;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
@ -70,4 +72,4 @@ trait CompoundFilterTrait
$filter->apply($queryBuilder); $filter->apply($queryBuilder);
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use App\DataTables\Filters\FilterInterface; use App\DataTables\Filters\FilterInterface;
@ -45,4 +47,4 @@ abstract class AbstractConstraint implements FilterInterface
{ {
$this->identifier = $identifier ?? $this->generateParameterIdentifier($property); $this->identifier = $identifier ?? $this->generateParameterIdentifier($property);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -61,4 +63,4 @@ class BooleanConstraint extends AbstractConstraint
$this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, '=', $this->value); $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, '=', $this->value);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -68,7 +70,7 @@ class ChoiceConstraint extends AbstractConstraint
public function isEnabled(): bool public function isEnabled(): bool
{ {
return !empty($this->operator); return $this->operator !== '';
} }
public function apply(QueryBuilder $queryBuilder): void public function apply(QueryBuilder $queryBuilder): void
@ -91,4 +93,4 @@ class ChoiceConstraint extends AbstractConstraint
throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES));
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
/** /**
@ -25,4 +27,4 @@ namespace App\DataTables\Filters\Constraints;
*/ */
class DateTimeConstraint extends NumberConstraint class DateTimeConstraint extends NumberConstraint
{ {
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
@ -112,7 +114,7 @@ class EntityConstraint extends AbstractConstraint
public function isEnabled(): bool public function isEnabled(): bool
{ {
return !empty($this->operator); return $this->operator !== null && $this->operator !== '';
} }
public function apply(QueryBuilder $queryBuilder): void public function apply(QueryBuilder $queryBuilder): void
@ -167,4 +169,4 @@ class EntityConstraint extends AbstractConstraint
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -71,4 +73,4 @@ trait FilterTrait
$queryBuilder->setParameter($parameterIdentifier, $value); $queryBuilder->setParameter($parameterIdentifier, $value);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -75,7 +77,7 @@ class InstanceOfConstraint extends AbstractConstraint
public function isEnabled(): bool public function isEnabled(): bool
{ {
return !empty($this->operator); return $this->operator !== '';
} }
public function apply(QueryBuilder $queryBuilder): void public function apply(QueryBuilder $queryBuilder): void
@ -107,4 +109,4 @@ class InstanceOfConstraint extends AbstractConstraint
throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES));
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -35,4 +37,4 @@ class IntConstraint extends NumberConstraint
parent::apply($queryBuilder); parent::apply($queryBuilder);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -82,7 +84,7 @@ class NumberConstraint extends AbstractConstraint
public function isEnabled(): bool public function isEnabled(): bool
{ {
return $this->value1 !== null return $this->value1 !== null
&& !empty($this->operator); && ($this->operator !== null && $this->operator !== '');
} }
public function apply(QueryBuilder $queryBuilder): void public function apply(QueryBuilder $queryBuilder): void
@ -108,4 +110,4 @@ class NumberConstraint extends AbstractConstraint
$this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier . '2', '<=', $this->value2); $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier . '2', '<=', $this->value2);
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints\Part; namespace App\DataTables\Filters\Constraints\Part;
use App\DataTables\Filters\Constraints\BooleanConstraint; use App\DataTables\Filters\Constraints\BooleanConstraint;
@ -44,4 +46,4 @@ class LessThanDesiredConstraint extends BooleanConstraint
$queryBuilder->andHaving('amountSum >= part.minamount'); $queryBuilder->andHaving('amountSum >= part.minamount');
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints\Part; namespace App\DataTables\Filters\Constraints\Part;
use App\DataTables\Filters\Constraints\AbstractConstraint; use App\DataTables\Filters\Constraints\AbstractConstraint;
@ -72,19 +74,19 @@ class ParameterConstraint extends AbstractConstraint
->from(PartParameter::class, $this->alias) ->from(PartParameter::class, $this->alias)
->where($this->alias . '.element = part'); ->where($this->alias . '.element = part');
if (!empty($this->name)) { if ($this->name !== '') {
$paramName = $this->generateParameterIdentifier('params.name'); $paramName = $this->generateParameterIdentifier('params.name');
$subqb->andWhere($this->alias . '.name = :' . $paramName); $subqb->andWhere($this->alias . '.name = :' . $paramName);
$queryBuilder->setParameter($paramName, $this->name); $queryBuilder->setParameter($paramName, $this->name);
} }
if (!empty($this->symbol)) { if ($this->symbol !== '') {
$paramName = $this->generateParameterIdentifier('params.symbol'); $paramName = $this->generateParameterIdentifier('params.symbol');
$subqb->andWhere($this->alias . '.symbol = :' . $paramName); $subqb->andWhere($this->alias . '.symbol = :' . $paramName);
$queryBuilder->setParameter($paramName, $this->symbol); $queryBuilder->setParameter($paramName, $this->symbol);
} }
if (!empty($this->unit)) { if ($this->unit !== '') {
$paramName = $this->generateParameterIdentifier('params.unit'); $paramName = $this->generateParameterIdentifier('params.unit');
$subqb->andWhere($this->alias . '.unit = :' . $paramName); $subqb->andWhere($this->alias . '.unit = :' . $paramName);
$queryBuilder->setParameter($paramName, $this->unit); $queryBuilder->setParameter($paramName, $this->unit);
@ -147,4 +149,4 @@ class ParameterConstraint extends AbstractConstraint
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints\Part; namespace App\DataTables\Filters\Constraints\Part;
use App\DataTables\Filters\Constraints\NumberConstraint; use App\DataTables\Filters\Constraints\NumberConstraint;
@ -141,4 +143,4 @@ class ParameterValueConstraint extends NumberConstraint
//For all other cases use the default implementation //For all other cases use the default implementation
parent::apply($queryBuilder); parent::apply($queryBuilder);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints\Part; namespace App\DataTables\Filters\Constraints\Part;
use Doctrine\ORM\Query\Expr\Orx; use Doctrine\ORM\Query\Expr\Orx;
@ -74,7 +76,7 @@ class TagsConstraint extends AbstractConstraint
public function isEnabled(): bool public function isEnabled(): bool
{ {
return $this->value !== null return $this->value !== null
&& !empty($this->operator); && ($this->operator !== null && $this->operator !== '');
} }
/** /**
@ -141,4 +143,4 @@ class TagsConstraint extends AbstractConstraint
return; return;
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters\Constraints; namespace App\DataTables\Filters\Constraints;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -72,7 +74,7 @@ class TextConstraint extends AbstractConstraint
public function isEnabled(): bool public function isEnabled(): bool
{ {
return $this->value !== null return $this->value !== null
&& !empty($this->operator); && ($this->operator !== null && $this->operator !== '');
} }
public function apply(QueryBuilder $queryBuilder): void public function apply(QueryBuilder $queryBuilder): void
@ -115,4 +117,4 @@ class TextConstraint extends AbstractConstraint
$queryBuilder->setParameter($this->identifier, $this->value); $queryBuilder->setParameter($this->identifier, $this->value);
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters; namespace App\DataTables\Filters;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -31,4 +33,4 @@ interface FilterInterface
* @return void * @return void
*/ */
public function apply(QueryBuilder $queryBuilder): void; public function apply(QueryBuilder $queryBuilder): void;
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters; namespace App\DataTables\Filters;
use App\DataTables\Filters\Constraints\ChoiceConstraint; use App\DataTables\Filters\Constraints\ChoiceConstraint;
@ -97,4 +99,4 @@ class LogFilter implements FilterInterface
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters; namespace App\DataTables\Filters;
use App\DataTables\Filters\Constraints\BooleanConstraint; use App\DataTables\Filters\Constraints\BooleanConstraint;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Filters; namespace App\DataTables\Filters;
use Doctrine\ORM\Query\Expr; use Doctrine\ORM\Query\Expr;
@ -121,7 +123,7 @@ class PartSearchFilter implements FilterInterface
$fields_to_search = $this->getFieldsToSearch(); $fields_to_search = $this->getFieldsToSearch();
//If we have nothing to search for, do nothing //If we have nothing to search for, do nothing
if ($fields_to_search === [] || empty($this->keyword)) { if ($fields_to_search === [] || $this->keyword === '') {
return; return;
} }
@ -302,4 +304,4 @@ class PartSearchFilter implements FilterInterface
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables\Helpers; namespace App\DataTables\Helpers;
use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\Project;
@ -83,4 +85,4 @@ class PartDataTableHelper
$title $title
); );
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\DataTables; namespace App\DataTables;
use App\DataTables\Column\EntityColumn; use App\DataTables\Column\EntityColumn;
@ -88,7 +90,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
} }
if($context->getPart() instanceof Part) { if($context->getPart() instanceof Part) {
$tmp = $this->partDataTableHelper->renderName($context->getPart()); $tmp = $this->partDataTableHelper->renderName($context->getPart());
if(!empty($context->getName())) { if($context->getName() !== null && $context->getName() !== '') {
$tmp .= '<br><b>'.htmlspecialchars($context->getName()).'</b>'; $tmp .= '<br><b>'.htmlspecialchars($context->getName()).'</b>';
} }
return $tmp; return $tmp;
@ -183,4 +185,4 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
{ {
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Doctrine\Purger; namespace App\Doctrine\Purger;
use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory; use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory;
@ -35,4 +37,4 @@ class ResetAutoIncrementPurgerFactory implements PurgerFactory
return $purger; return $purger;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Doctrine; namespace App\Doctrine;
use App\Exceptions\InvalidRegexException; use App\Exceptions\InvalidRegexException;
@ -55,4 +57,4 @@ class SQLiteRegexExtension
} }
} }
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Doctrine\SetSQLMode; namespace App\Doctrine\SetSQLMode;
use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver\Connection;
@ -40,4 +42,4 @@ class SetSQLModeMiddlewareDriver extends AbstractDriverMiddleware
return parent::connect($params); return parent::connect($params);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Doctrine\SetSQLMode; namespace App\Doctrine\SetSQLMode;
use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver;
@ -33,4 +35,4 @@ class SetSQLModeMiddlewareWrapper implements Middleware
{ {
return new SetSQLModeMiddlewareDriver($driver); return new SetSQLModeMiddlewareDriver($driver);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/** /**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Doctrine\Types; namespace App\Doctrine\Types;
use Brick\Math\BigDecimal; use Brick\Math\BigDecimal;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Doctrine\Types; namespace App\Doctrine\Types;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
@ -44,4 +46,4 @@ class TinyIntType extends Type
//We use the comment, so that doctrine migrations can properly detect, that nothing has changed and no migration is needed. //We use the comment, so that doctrine migrations can properly detect, that nothing has changed and no migration is needed.
return true; return true;
} }
} }

View file

@ -182,7 +182,7 @@ abstract class Attachment extends AbstractNamedDBElement
public function isExternal(): bool public function isExternal(): bool
{ {
//When path is empty, this attachment can not be external //When path is empty, this attachment can not be external
if (empty($this->path)) { if ($this->path === '') {
return false; return false;
} }
@ -236,7 +236,7 @@ abstract class Attachment extends AbstractNamedDBElement
return null; return null;
} }
if (!empty($this->original_filename)) { if ($this->original_filename !== null && $this->original_filename !== '') {
return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION)); return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION));
} }
@ -302,7 +302,7 @@ abstract class Attachment extends AbstractNamedDBElement
} }
//If we have a stored original filename, then use it //If we have a stored original filename, then use it
if (!empty($this->original_filename)) { if ($this->original_filename !== null && $this->original_filename !== '') {
return $this->original_filename; return $this->original_filename;
} }
@ -411,7 +411,7 @@ abstract class Attachment extends AbstractNamedDBElement
public function setURL(?string $url): self public function setURL(?string $url): self
{ {
//Only set if the URL is not empty //Only set if the URL is not empty
if (!empty($url)) { if ($url !== null && $url !== '') {
if (str_contains($url, '%BASE%') || str_contains($url, '%MEDIA%')) { if (str_contains($url, '%BASE%') || str_contains($url, '%MEDIA%')) {
throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!'); throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/** /**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Entity\Base; namespace App\Entity\Base;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Entity\Contracts; namespace App\Entity\Contracts;
interface LogWithNewDataInterface interface LogWithNewDataInterface
@ -38,4 +40,4 @@ interface LogWithNewDataInterface
* @return $this * @return $this
*/ */
public function setNewData(array $new_data): self; public function setNewData(array $new_data): self;
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Entity\LogSystem; namespace App\Entity\LogSystem;
use App\Entity\Parts\PartLot; use App\Entity\Parts\PartLot;
@ -64,7 +66,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry
'n' => $new_stock, 'n' => $new_stock,
'p' => $new_total_part_instock, 'p' => $new_total_part_instock,
]); ]);
if (!empty($comment)) { if ($comment !== '') {
$this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...'); $this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...');
} }
@ -201,4 +203,4 @@ class PartStockChangedLogEntry extends AbstractLogEntry
default => throw new \InvalidArgumentException('Invalid short type: '.$short_type), default => throw new \InvalidArgumentException('Invalid short type: '.$short_type),
}; };
} }
} }

View file

@ -394,7 +394,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
protected function formatWithUnit(float $value, string $format = '%g'): string protected function formatWithUnit(float $value, string $format = '%g'): string
{ {
$str = sprintf($format, $value); $str = sprintf($format, $value);
if (!empty($this->unit)) { if ($this->unit !== '') {
return $str.' '.$this->unit; return $str.' '.$this->unit;
} }

View file

@ -147,7 +147,7 @@ class Part extends AttachmentContainingDBElement
//Ensure that the part name fullfills the regex of the category //Ensure that the part name fullfills the regex of the category
if ($this->category instanceof Category) { if ($this->category instanceof Category) {
$regex = $this->category->getPartnameRegex(); $regex = $this->category->getPartnameRegex();
if (!empty($regex) && !preg_match($regex, $this->name)) { if ($regex !== '' && !preg_match($regex, $this->name)) {
$context->buildViolation('part.name.must_match_category_regex') $context->buildViolation('part.name.must_match_category_regex')
->atPath('name') ->atPath('name')
->setParameter('%regex%', $regex) ->setParameter('%regex%', $regex)

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace App\Entity\Parts\PartTraits; namespace App\Entity\Parts\PartTraits;
use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\Project;
@ -81,4 +83,4 @@ trait ProjectTrait
return $projects; return $projects;
} }
} }

View file

@ -242,7 +242,7 @@ class ProjectBOMEntry extends AbstractDBElement
} }
//Check that the number of mountnames is the same as the (rounded) quantity //Check that the number of mountnames is the same as the (rounded) quantity
if (!empty($this->mountnames) && count($uniq_mountnames) !== (int) round ($this->quantity)) { if ($this->mountnames !== '' && count($uniq_mountnames) !== (int) round ($this->quantity)) {
$context->buildViolation('project.bom_entry.mountnames_quantity_mismatch') $context->buildViolation('project.bom_entry.mountnames_quantity_mismatch')
->atPath('mountnames') ->atPath('mountnames')
->addViolation(); ->addViolation();

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Entity\UserSystem; namespace App\Entity\UserSystem;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
@ -228,4 +230,4 @@ final class PermissionData implements \JsonSerializable
return $this; return $this;
} }
} }

View file

@ -500,7 +500,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
{ {
$tmp = $this->getFirstName(); $tmp = $this->getFirstName();
//Don't add a space, if the name has only one part (it would look strange) //Don't add a space, if the name has only one part (it would look strange)
if (!empty($this->getFirstName()) && !empty($this->getLastName())) { if ($this->getFirstName() !== null && $this->getFirstName() !== '' && ($this->getLastName() !== null && $this->getLastName() !== '')) {
$tmp .= ' '; $tmp .= ' ';
} }
$tmp .= $this->getLastName(); $tmp .= $this->getLastName();

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Entity\UserSystem; namespace App\Entity\UserSystem;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
@ -89,4 +91,4 @@ class WebauthnKey extends BasePublicKeyCredentialSource
$registration->getOtherUI() $registration->getOtherUI()
); );
} }
} }

View file

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

View file

@ -55,8 +55,8 @@ class LogDBMigrationSubscriber implements EventSubscriber
$this->new_version = (string) $aliasResolver->resolveVersionAlias('current'); $this->new_version = (string) $aliasResolver->resolveVersionAlias('current');
//After everything is done, write the results to DB log //After everything is done, write the results to DB log
$this->old_version = empty($this->old_version) ? 'legacy/empty' : $this->old_version; $this->old_version = $this->old_version === null || $this->old_version === '' ? 'legacy/empty' : $this->old_version;
$this->new_version = empty($this->new_version) ? 'unknown' : $this->new_version; $this->new_version = $this->new_version === '' ? 'unknown' : $this->new_version;
try { try {
$log = new DatabaseUpdatedLogEntry($this->old_version, $this->new_version); $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 //Check if the user has set a timezone
$user = $this->security->getUser(); $user = $this->security->getUser();
if ($user instanceof User && !empty($user->getTimezone())) { if ($user instanceof User && ($user->getTimezone() !== null && $user->getTimezone() !== '')) {
$timezone = $user->getTimezone(); $timezone = $user->getTimezone();
} }
//Fill with default value if needed //Fill with default value if needed
if (null === $timezone && !empty($this->default_timezone)) { if (null === $timezone && $this->default_timezone !== '') {
$timezone = $this->default_timezone; $timezone = $this->default_timezone;
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\EventSubscriber\UserSystem; namespace App\EventSubscriber\UserSystem;
use Symfony\Bundle\SecurityBundle\Security; use Symfony\Bundle\SecurityBundle\Security;
@ -68,4 +70,4 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
{ {
return [KernelEvents::REQUEST => 'onRequest']; return [KernelEvents::REQUEST => 'onRequest'];
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\DriverException;
@ -69,4 +71,4 @@ class InvalidRegexException extends \RuntimeException
return new self($reason); return new self($reason);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\AdminPages; namespace App\Form\AdminPages;
use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractNamedDBElement;
@ -59,4 +61,4 @@ class ProjectAdminForm extends BaseEntityAdminForm
], ],
]); ]);
} }
} }

View file

@ -144,7 +144,7 @@ class AttachmentFormType extends AbstractType
} }
//If the name is empty, use the original file name as attachment name //If the name is empty, use the original file name as attachment name
if (empty($attachment->getName())) { if ($attachment->getName() === '') {
$attachment->setName($file->getClientOriginalName()); $attachment->setName($file->getClientOriginalName());
} }
}, 100000); }, 100000);

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters; namespace App\Form\Filters;
use App\DataTables\Filters\AttachmentFilter; use App\DataTables\Filters\AttachmentFilter;
@ -114,4 +116,4 @@ class AttachmentFilterType extends AbstractType
'label' => 'filter.discard', 'label' => 'filter.discard',
]); ]);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\BooleanConstraint; use App\DataTables\Filters\Constraints\BooleanConstraint;
@ -51,4 +53,4 @@ class BooleanConstraintType extends AbstractType
//Remove the label from the compound form, as the checkbox already has a label //Remove the label from the compound form, as the checkbox already has a label
$view->vars['label'] = false; $view->vars['label'] = false;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\ChoiceConstraint; use App\DataTables\Filters\Constraints\ChoiceConstraint;
@ -63,4 +65,4 @@ class ChoiceConstraintType extends AbstractType
]); ]);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\DateTimeConstraint; use App\DataTables\Filters\Constraints\DateTimeConstraint;
@ -90,4 +92,4 @@ class DateTimeConstraintType extends AbstractType
$view->vars['text_suffix'] = $options['text_suffix']; $view->vars['text_suffix'] = $options['text_suffix'];
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\InstanceOfConstraint; use App\DataTables\Filters\Constraints\InstanceOfConstraint;
@ -40,4 +42,4 @@ class InstanceOfConstraintType extends AbstractType
{ {
return ChoiceConstraintType::class; return ChoiceConstraintType::class;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\NumberConstraint; use App\DataTables\Filters\Constraints\NumberConstraint;
@ -95,4 +97,4 @@ class NumberConstraintType extends AbstractType
{ {
$view->vars['text_suffix'] = $options['text_suffix']; $view->vars['text_suffix'] = $options['text_suffix'];
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\Part\ParameterConstraint; use App\DataTables\Filters\Constraints\Part\ParameterConstraint;
@ -75,4 +77,4 @@ class ParameterConstraintType extends AbstractType
} }
}); });
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
class ParameterValueConstraintType extends NumberConstraintType class ParameterValueConstraintType extends NumberConstraintType
@ -48,4 +50,4 @@ class ParameterValueConstraintType extends NumberConstraintType
{ {
return NumberConstraintType::class; return NumberConstraintType::class;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\EntityConstraint; use App\DataTables\Filters\Constraints\EntityConstraint;
@ -70,4 +72,4 @@ class StructuralEntityConstraintType extends AbstractType
parent::buildView($view, $form, $options); parent::buildView($view, $form, $options);
$view->vars['text_suffix'] = $options['text_suffix']; $view->vars['text_suffix'] = $options['text_suffix'];
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\Part\TagsConstraint; use App\DataTables\Filters\Constraints\Part\TagsConstraint;
@ -68,4 +70,4 @@ class TagsConstraintType extends AbstractType
'required' => false, 'required' => false,
]); ]);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\TextConstraint; use App\DataTables\Filters\Constraints\TextConstraint;
@ -76,4 +78,4 @@ class TextConstraintType extends AbstractType
$view->vars['text_suffix'] = $options['text_suffix']; $view->vars['text_suffix'] = $options['text_suffix'];
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters\Constraints; namespace App\Form\Filters\Constraints;
use App\DataTables\Filters\Constraints\EntityConstraint; use App\DataTables\Filters\Constraints\EntityConstraint;
@ -65,4 +67,4 @@ class UserEntityConstraintType extends AbstractType
parent::buildView($view, $form, $options); parent::buildView($view, $form, $options);
$view->vars['text_suffix'] = $options['text_suffix']; $view->vars['text_suffix'] = $options['text_suffix'];
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters; namespace App\Form\Filters;
use App\DataTables\Filters\LogFilter; use App\DataTables\Filters\LogFilter;
@ -168,4 +170,4 @@ class LogFilterType extends AbstractType
'label' => 'filter.discard', 'label' => 'filter.discard',
]); ]);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Filters; namespace App\Form\Filters;
use App\DataTables\Filters\Constraints\Part\ParameterConstraint; use App\DataTables\Filters\Constraints\Part\ParameterConstraint;
@ -277,4 +279,4 @@ class PartFilterType extends AbstractType
]); ]);
} }
} }

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace App\Form\ProjectSystem; namespace App\Form\ProjectSystem;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
@ -27,4 +29,4 @@ class ProjectBOMEntryCollectionType extends AbstractType
'label' => false, 'label' => false,
]); ]);
} }
} }

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace App\Form\ProjectSystem; namespace App\Form\ProjectSystem;
use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Entity\ProjectSystem\ProjectBOMEntry;
@ -87,4 +89,4 @@ class ProjectBOMEntryType extends AbstractType
'data_class' => ProjectBOMEntry::class, 'data_class' => ProjectBOMEntry::class,
]); ]);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\ProjectSystem; namespace App\Form\ProjectSystem;
use Symfony\Bundle\SecurityBundle\Security; use Symfony\Bundle\SecurityBundle\Security;
@ -153,7 +155,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface
if (!$lot) { //When the user selected "Create new lot", create a new lot if (!$lot) { //When the user selected "Create new lot", create a new lot
$lot = new PartLot(); $lot = new PartLot();
$description = 'Build ' . date('Y-m-d H:i:s'); $description = 'Build ' . date('Y-m-d H:i:s');
if (!empty($data->getComment())) { if ($data->getComment() !== '') {
$description .= ' (' . $data->getComment() . ')'; $description .= ' (' . $data->getComment() . ')';
} }
$lot->setDescription($description); $lot->setDescription($description);
@ -166,4 +168,4 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface
//This has to be set after the builds part lot, so that it can disable the option //This has to be set after the builds part lot, so that it can disable the option
$data->setAddBuildsToBuildsPart($forms['addBuildsToBuildsPart']->getData()); $data->setAddBuildsToBuildsPart($forms['addBuildsToBuildsPart']->getData());
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/** /**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type; namespace App\Form\Type;
use Brick\Math\BigDecimal; use Brick\Math\BigDecimal;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/** /**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type; namespace App\Form\Type;
use Brick\Math\BigDecimal; use Brick\Math\BigDecimal;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type\Helper; namespace App\Form\Type\Helper;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
@ -82,7 +84,7 @@ class StructuralEntityChoiceHelper
; ;
} }
if ($choice instanceof AttachmentType && !empty($choice->getFiletypeFilter())) { if ($choice instanceof AttachmentType && $choice->getFiletypeFilter() !== '') {
$tmp += ['data-filetype_filter' => $choice->getFiletypeFilter()]; $tmp += ['data-filetype_filter' => $choice->getFiletypeFilter()];
} }
@ -96,7 +98,7 @@ class StructuralEntityChoiceHelper
public function generateChoiceAttrCurrency(Currency $choice, Options|array $options): array public function generateChoiceAttrCurrency(Currency $choice, Options|array $options): array
{ {
$tmp = $this->generateChoiceAttr($choice, $options); $tmp = $this->generateChoiceAttr($choice, $options);
$symbol = empty($choice->getIsoCode()) ? null : Currencies::getSymbol($choice->getIsoCode()); $symbol = $choice->getIsoCode() === null || $choice->getIsoCode() === '' ? null : Currencies::getSymbol($choice->getIsoCode());
$tmp['data-short'] = $options['short'] ? $symbol : $choice->getName(); $tmp['data-short'] = $options['short'] ? $symbol : $choice->getName();
return $tmp + [ return $tmp + [
@ -147,4 +149,4 @@ class StructuralEntityChoiceHelper
return null; return null;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type\Helper; namespace App\Form\Type\Helper;
use App\Repository\StructuralDBElementRepository; use App\Repository\StructuralDBElementRepository;
@ -84,4 +86,4 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader
return $this->additional_element; return $this->additional_element;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\Parts\Storelocation; use App\Entity\Parts\Storelocation;
@ -51,4 +53,4 @@ class PartLotSelectType extends AbstractType
->setParameter('part', $options['part']) ->setParameter('part', $options['part'])
]); ]);
} }
} }

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\Attachments\Attachment; use App\Entity\Attachments\Attachment;
@ -122,4 +124,4 @@ class PartSelectType extends AbstractType implements DataMapperInterface
$data = $form->getData(); $data = $form->getData();
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type; namespace App\Form\Type;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
@ -61,4 +63,4 @@ class RichTextEditorType extends AbstractType
{ {
return TextareaType::class; return TextareaType::class;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type; namespace App\Form\Type;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
@ -45,4 +47,4 @@ class ThemeChoiceType extends AbstractType
]); ]);
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\UserSystem\User; use App\Entity\UserSystem\User;
@ -40,4 +42,4 @@ class UserSelectType extends AbstractType
{ {
return StructuralEntityType::class; return StructuralEntityType::class;
} }
} }

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Helpers\Projects; namespace App\Helpers\Projects;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
@ -283,4 +285,4 @@ final class ProjectBuildRequest
{ {
return $this->number_of_builds; return $this->number_of_builds;
} }
} }

View file

@ -40,7 +40,7 @@ final class TreeViewNodeIterator extends ArrayIterator implements RecursiveItera
/** @var TreeViewNode $element */ /** @var TreeViewNode $element */
$element = $this->current(); $element = $this->current();
return !empty($element->getNodes()); return $element->getNodes() !== null && $element->getNodes() !== [];
} }
public function getChildren(): TreeViewNodeIterator public function getChildren(): TreeViewNodeIterator

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App; namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Migration; namespace App\Migration;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
@ -88,7 +90,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
*/ */
public function getInitalAdminPW(): string public function getInitalAdminPW(): string
{ {
if (empty($this->admin_pw)) { if ($this->admin_pw === '') {
if (!empty($_ENV['INITIAL_ADMIN_PW'])) { if (!empty($_ENV['INITIAL_ADMIN_PW'])) {
$this->admin_pw = $_ENV['INITIAL_ADMIN_PW']; $this->admin_pw = $_ENV['INITIAL_ADMIN_PW'];
} else { } else {
@ -104,7 +106,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
{ {
parent::postUp($schema); parent::postUp($schema);
if (!empty($this->admin_pw)) { if ($this->admin_pw !== '') {
$this->logger->warning(''); $this->logger->warning('');
$this->logger->warning('<bg=yellow;fg=black>The initial password for the "admin" user is: '.$this->admin_pw.'</>'); $this->logger->warning('<bg=yellow;fg=black>The initial password for the "admin" user is: '.$this->admin_pw.'</>');
$this->logger->warning(''); $this->logger->warning('');

View file

@ -1,4 +1,7 @@
<?php <?php
declare(strict_types=1);
/** /**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). * 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 * 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/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
namespace App\Repository; namespace App\Repository;
use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Base\AbstractPartsContainingDBElement;

Some files were not shown because too many files have changed in this diff Show more