mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Added declare strict types to all files
This commit is contained in:
parent
bea90a7d94
commit
6a2ff9d153
196 changed files with 685 additions and 360 deletions
13
rector.php
13
rector.php
|
@ -2,15 +2,17 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Doctrine\Set\DoctrineSetList;
|
||||
use Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector;
|
||||
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
|
||||
use Rector\PHPUnit\Set\PHPUnitSetList;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Rector\Symfony\Set\SymfonyLevelSetList;
|
||||
use Rector\Symfony\Set\SymfonySetList;
|
||||
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml');
|
||||
|
@ -31,6 +33,10 @@ return static function (RectorConfig $rectorConfig): void {
|
|||
// register a single rule
|
||||
//$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
|
||||
|
||||
$rectorConfig->rules([
|
||||
DeclareStrictTypesRector::class,
|
||||
]);
|
||||
|
||||
// define sets of rules
|
||||
$rectorConfig->sets([
|
||||
//PHP rules
|
||||
|
@ -49,4 +55,9 @@ return static function (RectorConfig $rectorConfig): void {
|
|||
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
|
||||
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
|
||||
]);
|
||||
|
||||
$rectorConfig->skip([
|
||||
AddDoesNotPerformAssertionToNonAssertingTestRector::class,
|
||||
CountArrayToEmptyArrayComparisonRector::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
|
|
@ -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\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -187,4 +189,4 @@ class CheckRequirementsCommand extends Command
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Command\Migrations;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -141,4 +143,4 @@ class ImportPartKeeprCommand extends Command
|
|||
$io->success('Imported '.$count.' parts.');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Command\User;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -105,4 +107,4 @@ class ConvertToSAMLUserCommand extends Command
|
|||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Command\User;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
|
|
@ -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\Command\User;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -99,4 +101,4 @@ class UserEnableCommand extends Command
|
|||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Command\User;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -93,4 +95,4 @@ class UserListCommand extends Command
|
|||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Command\User;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
|
|
@ -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\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
|
@ -60,4 +62,4 @@ class VersionCommand extends Command
|
|||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
|||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Adapters;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -50,4 +52,4 @@ class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter
|
|||
|
||||
return $paginator->count();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Column;
|
||||
|
||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||
|
@ -60,4 +62,4 @@ class PrettyBoolColumn extends AbstractColumn
|
|||
|
||||
throw new \RuntimeException('Unexpected value!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Column;
|
||||
|
||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||
|
@ -55,4 +57,4 @@ class RowClassColumn extends AbstractColumn
|
|||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Column;
|
||||
|
||||
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']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Column;
|
||||
|
||||
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 '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables;
|
||||
|
||||
use App\DataTables\Column\RowClassColumn;
|
||||
|
@ -78,4 +80,4 @@ class ErrorDataTable implements DataTableTypeInterface
|
|||
$error_table->handleRequest($request);
|
||||
return $error_table->getResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters;
|
||||
|
||||
use App\DataTables\Filters\Constraints\BooleanConstraint;
|
||||
|
@ -102,4 +104,4 @@ class AttachmentFilter implements FilterInterface
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -70,4 +72,4 @@ trait CompoundFilterTrait
|
|||
$filter->apply($queryBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\FilterInterface;
|
||||
|
@ -45,4 +47,4 @@ abstract class AbstractConstraint implements FilterInterface
|
|||
{
|
||||
$this->identifier = $identifier ?? $this->generateParameterIdentifier($property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -61,4 +63,4 @@ class BooleanConstraint extends AbstractConstraint
|
|||
|
||||
$this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, '=', $this->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -68,7 +70,7 @@ class ChoiceConstraint extends AbstractConstraint
|
|||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return !empty($this->operator);
|
||||
return $this->operator !== '';
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
/**
|
||||
|
@ -25,4 +27,4 @@ namespace App\DataTables\Filters\Constraints;
|
|||
*/
|
||||
class DateTimeConstraint extends NumberConstraint
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
|
@ -112,7 +114,7 @@ class EntityConstraint extends AbstractConstraint
|
|||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return !empty($this->operator);
|
||||
return $this->operator !== null && $this->operator !== '';
|
||||
}
|
||||
|
||||
public function apply(QueryBuilder $queryBuilder): void
|
||||
|
@ -167,4 +169,4 @@ class EntityConstraint extends AbstractConstraint
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -71,4 +73,4 @@ trait FilterTrait
|
|||
|
||||
$queryBuilder->setParameter($parameterIdentifier, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -75,7 +77,7 @@ class InstanceOfConstraint extends AbstractConstraint
|
|||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return !empty($this->operator);
|
||||
return $this->operator !== '';
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -35,4 +37,4 @@ class IntConstraint extends NumberConstraint
|
|||
|
||||
parent::apply($queryBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -82,7 +84,7 @@ class NumberConstraint extends AbstractConstraint
|
|||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->value1 !== null
|
||||
&& !empty($this->operator);
|
||||
&& ($this->operator !== null && $this->operator !== '');
|
||||
}
|
||||
|
||||
public function apply(QueryBuilder $queryBuilder): void
|
||||
|
@ -108,4 +110,4 @@ class NumberConstraint extends AbstractConstraint
|
|||
$this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier . '2', '<=', $this->value2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints\Part;
|
||||
|
||||
use App\DataTables\Filters\Constraints\BooleanConstraint;
|
||||
|
@ -44,4 +46,4 @@ class LessThanDesiredConstraint extends BooleanConstraint
|
|||
$queryBuilder->andHaving('amountSum >= part.minamount');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints\Part;
|
||||
|
||||
use App\DataTables\Filters\Constraints\AbstractConstraint;
|
||||
|
@ -72,19 +74,19 @@ class ParameterConstraint extends AbstractConstraint
|
|||
->from(PartParameter::class, $this->alias)
|
||||
->where($this->alias . '.element = part');
|
||||
|
||||
if (!empty($this->name)) {
|
||||
if ($this->name !== '') {
|
||||
$paramName = $this->generateParameterIdentifier('params.name');
|
||||
$subqb->andWhere($this->alias . '.name = :' . $paramName);
|
||||
$queryBuilder->setParameter($paramName, $this->name);
|
||||
}
|
||||
|
||||
if (!empty($this->symbol)) {
|
||||
if ($this->symbol !== '') {
|
||||
$paramName = $this->generateParameterIdentifier('params.symbol');
|
||||
$subqb->andWhere($this->alias . '.symbol = :' . $paramName);
|
||||
$queryBuilder->setParameter($paramName, $this->symbol);
|
||||
}
|
||||
|
||||
if (!empty($this->unit)) {
|
||||
if ($this->unit !== '') {
|
||||
$paramName = $this->generateParameterIdentifier('params.unit');
|
||||
$subqb->andWhere($this->alias . '.unit = :' . $paramName);
|
||||
$queryBuilder->setParameter($paramName, $this->unit);
|
||||
|
@ -147,4 +149,4 @@ class ParameterConstraint extends AbstractConstraint
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints\Part;
|
||||
|
||||
use App\DataTables\Filters\Constraints\NumberConstraint;
|
||||
|
@ -141,4 +143,4 @@ class ParameterValueConstraint extends NumberConstraint
|
|||
//For all other cases use the default implementation
|
||||
parent::apply($queryBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints\Part;
|
||||
|
||||
use Doctrine\ORM\Query\Expr\Orx;
|
||||
|
@ -74,7 +76,7 @@ class TagsConstraint extends AbstractConstraint
|
|||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->value !== null
|
||||
&& !empty($this->operator);
|
||||
&& ($this->operator !== null && $this->operator !== '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,4 +143,4 @@ class TagsConstraint extends AbstractConstraint
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters\Constraints;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -72,7 +74,7 @@ class TextConstraint extends AbstractConstraint
|
|||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->value !== null
|
||||
&& !empty($this->operator);
|
||||
&& ($this->operator !== null && $this->operator !== '');
|
||||
}
|
||||
|
||||
public function apply(QueryBuilder $queryBuilder): void
|
||||
|
@ -115,4 +117,4 @@ class TextConstraint extends AbstractConstraint
|
|||
$queryBuilder->setParameter($this->identifier, $this->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -31,4 +33,4 @@ interface FilterInterface
|
|||
* @return void
|
||||
*/
|
||||
public function apply(QueryBuilder $queryBuilder): void;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters;
|
||||
|
||||
use App\DataTables\Filters\Constraints\ChoiceConstraint;
|
||||
|
@ -97,4 +99,4 @@ class LogFilter implements FilterInterface
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Filters;
|
||||
|
||||
use App\DataTables\Filters\Constraints\BooleanConstraint;
|
||||
|
|
|
@ -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\DataTables\Filters;
|
||||
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
@ -121,7 +123,7 @@ class PartSearchFilter implements FilterInterface
|
|||
$fields_to_search = $this->getFieldsToSearch();
|
||||
|
||||
//If we have nothing to search for, do nothing
|
||||
if ($fields_to_search === [] || empty($this->keyword)) {
|
||||
if ($fields_to_search === [] || $this->keyword === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -302,4 +304,4 @@ class PartSearchFilter implements FilterInterface
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables\Helpers;
|
||||
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
|
@ -83,4 +85,4 @@ class PartDataTableHelper
|
|||
$title
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\DataTables;
|
||||
|
||||
use App\DataTables\Column\EntityColumn;
|
||||
|
@ -88,7 +90,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
|||
}
|
||||
if($context->getPart() instanceof Part) {
|
||||
$tmp = $this->partDataTableHelper->renderName($context->getPart());
|
||||
if(!empty($context->getName())) {
|
||||
if($context->getName() !== null && $context->getName() !== '') {
|
||||
$tmp .= '<br><b>'.htmlspecialchars($context->getName()).'</b>';
|
||||
}
|
||||
return $tmp;
|
||||
|
@ -183,4 +185,4 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
|||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Doctrine\Purger;
|
||||
|
||||
use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory;
|
||||
|
@ -35,4 +37,4 @@ class ResetAutoIncrementPurgerFactory implements PurgerFactory
|
|||
|
||||
return $purger;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Doctrine;
|
||||
|
||||
use App\Exceptions\InvalidRegexException;
|
||||
|
@ -55,4 +57,4 @@ class SQLiteRegexExtension
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Doctrine\SetSQLMode;
|
||||
|
||||
use Doctrine\DBAL\Driver\Connection;
|
||||
|
@ -40,4 +42,4 @@ class SetSQLModeMiddlewareDriver extends AbstractDriverMiddleware
|
|||
|
||||
return parent::connect($params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Doctrine\SetSQLMode;
|
||||
|
||||
use Doctrine\DBAL\Driver;
|
||||
|
@ -33,4 +35,4 @@ class SetSQLModeMiddlewareWrapper implements Middleware
|
|||
{
|
||||
return new SetSQLModeMiddlewareDriver($driver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Doctrine\Types;
|
||||
|
||||
use Brick\Math\BigDecimal;
|
||||
|
|
|
@ -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\Doctrine\Types;
|
||||
|
||||
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.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
public function isExternal(): bool
|
||||
{
|
||||
//When path is empty, this attachment can not be external
|
||||
if (empty($this->path)) {
|
||||
if ($this->path === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
return null;
|
||||
}
|
||||
|
||||
if (!empty($this->original_filename)) {
|
||||
if ($this->original_filename !== null && $this->original_filename !== '') {
|
||||
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 (!empty($this->original_filename)) {
|
||||
if ($this->original_filename !== null && $this->original_filename !== '') {
|
||||
return $this->original_filename;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
public function setURL(?string $url): self
|
||||
{
|
||||
//Only set if the URL is not empty
|
||||
if (!empty($url)) {
|
||||
if ($url !== null && $url !== '') {
|
||||
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!');
|
||||
}
|
||||
|
|
|
@ -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\Entity\Base;
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
|
|
|
@ -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\Entity\Contracts;
|
||||
|
||||
interface LogWithNewDataInterface
|
||||
|
@ -38,4 +40,4 @@ interface LogWithNewDataInterface
|
|||
* @return $this
|
||||
*/
|
||||
public function setNewData(array $new_data): self;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Entity\LogSystem;
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
|
@ -64,7 +66,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry
|
|||
'n' => $new_stock,
|
||||
'p' => $new_total_part_instock,
|
||||
]);
|
||||
if (!empty($comment)) {
|
||||
if ($comment !== '') {
|
||||
$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),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -394,7 +394,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
protected function formatWithUnit(float $value, string $format = '%g'): string
|
||||
{
|
||||
$str = sprintf($format, $value);
|
||||
if (!empty($this->unit)) {
|
||||
if ($this->unit !== '') {
|
||||
return $str.' '.$this->unit;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ class Part extends AttachmentContainingDBElement
|
|||
//Ensure that the part name fullfills the regex of the category
|
||||
if ($this->category instanceof Category) {
|
||||
$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')
|
||||
->atPath('name')
|
||||
->setParameter('%regex%', $regex)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
|
@ -81,4 +83,4 @@ trait ProjectTrait
|
|||
|
||||
return $projects;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
}
|
||||
|
||||
//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')
|
||||
->atPath('mountnames')
|
||||
->addViolation();
|
||||
|
|
|
@ -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\Entity\UserSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
@ -228,4 +230,4 @@ final class PermissionData implements \JsonSerializable
|
|||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -500,7 +500,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
{
|
||||
$tmp = $this->getFirstName();
|
||||
//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 .= $this->getLastName();
|
||||
|
|
|
@ -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\Entity\UserSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
@ -89,4 +91,4 @@ class WebauthnKey extends BasePublicKeyCredentialSource
|
|||
$registration->getOtherUI()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
$uow = $em->getUnitOfWork();
|
||||
// If we have added any ElementCreatedLogEntries added in postPersist, we flush them here.
|
||||
$uow->computeChangeSets();
|
||||
if ($uow->hasPendingInsertions() || !empty($uow->getScheduledEntityUpdates())) {
|
||||
if ($uow->hasPendingInsertions() || $uow->getScheduledEntityUpdates() !== []) {
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ class LogDBMigrationSubscriber implements EventSubscriber
|
|||
$this->new_version = (string) $aliasResolver->resolveVersionAlias('current');
|
||||
|
||||
//After everything is done, write the results to DB log
|
||||
$this->old_version = empty($this->old_version) ? 'legacy/empty' : $this->old_version;
|
||||
$this->new_version = empty($this->new_version) ? 'unknown' : $this->new_version;
|
||||
$this->old_version = $this->old_version === null || $this->old_version === '' ? 'legacy/empty' : $this->old_version;
|
||||
$this->new_version = $this->new_version === '' ? 'unknown' : $this->new_version;
|
||||
|
||||
try {
|
||||
$log = new DatabaseUpdatedLogEntry($this->old_version, $this->new_version);
|
||||
|
|
|
@ -43,12 +43,12 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
|
|||
|
||||
//Check if the user has set a timezone
|
||||
$user = $this->security->getUser();
|
||||
if ($user instanceof User && !empty($user->getTimezone())) {
|
||||
if ($user instanceof User && ($user->getTimezone() !== null && $user->getTimezone() !== '')) {
|
||||
$timezone = $user->getTimezone();
|
||||
}
|
||||
|
||||
//Fill with default value if needed
|
||||
if (null === $timezone && !empty($this->default_timezone)) {
|
||||
if (null === $timezone && $this->default_timezone !== '') {
|
||||
$timezone = $this->default_timezone;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -17,7 +20,6 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber\UserSystem;
|
||||
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
|
@ -68,4 +70,4 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
|
|||
{
|
||||
return [KernelEvents::REQUEST => 'onRequest'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Exceptions;
|
||||
|
||||
use Doctrine\DBAL\Exception\DriverException;
|
||||
|
@ -69,4 +71,4 @@ class InvalidRegexException extends \RuntimeException
|
|||
|
||||
return new self($reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\AdminPages;
|
||||
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
|
@ -59,4 +61,4 @@ class ProjectAdminForm extends BaseEntityAdminForm
|
|||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ class AttachmentFormType extends AbstractType
|
|||
}
|
||||
|
||||
//If the name is empty, use the original file name as attachment name
|
||||
if (empty($attachment->getName())) {
|
||||
if ($attachment->getName() === '') {
|
||||
$attachment->setName($file->getClientOriginalName());
|
||||
}
|
||||
}, 100000);
|
||||
|
|
|
@ -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\Form\Filters;
|
||||
|
||||
use App\DataTables\Filters\AttachmentFilter;
|
||||
|
@ -114,4 +116,4 @@ class AttachmentFilterType extends AbstractType
|
|||
'label' => 'filter.discard',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
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
|
||||
$view->vars['label'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\ChoiceConstraint;
|
||||
|
@ -63,4 +65,4 @@ class ChoiceConstraintType extends AbstractType
|
|||
]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\DateTimeConstraint;
|
||||
|
@ -90,4 +92,4 @@ class DateTimeConstraintType extends AbstractType
|
|||
|
||||
$view->vars['text_suffix'] = $options['text_suffix'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\InstanceOfConstraint;
|
||||
|
@ -40,4 +42,4 @@ class InstanceOfConstraintType extends AbstractType
|
|||
{
|
||||
return ChoiceConstraintType::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\NumberConstraint;
|
||||
|
@ -95,4 +97,4 @@ class NumberConstraintType extends AbstractType
|
|||
{
|
||||
$view->vars['text_suffix'] = $options['text_suffix'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\Part\ParameterConstraint;
|
||||
|
@ -75,4 +77,4 @@ class ParameterConstraintType extends AbstractType
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
class ParameterValueConstraintType extends NumberConstraintType
|
||||
|
@ -48,4 +50,4 @@ class ParameterValueConstraintType extends NumberConstraintType
|
|||
{
|
||||
return NumberConstraintType::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\EntityConstraint;
|
||||
|
@ -70,4 +72,4 @@ class StructuralEntityConstraintType extends AbstractType
|
|||
parent::buildView($view, $form, $options);
|
||||
$view->vars['text_suffix'] = $options['text_suffix'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\Part\TagsConstraint;
|
||||
|
@ -68,4 +70,4 @@ class TagsConstraintType extends AbstractType
|
|||
'required' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\TextConstraint;
|
||||
|
@ -76,4 +78,4 @@ class TextConstraintType extends AbstractType
|
|||
|
||||
$view->vars['text_suffix'] = $options['text_suffix'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\EntityConstraint;
|
||||
|
@ -65,4 +67,4 @@ class UserEntityConstraintType extends AbstractType
|
|||
parent::buildView($view, $form, $options);
|
||||
$view->vars['text_suffix'] = $options['text_suffix'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters;
|
||||
|
||||
use App\DataTables\Filters\LogFilter;
|
||||
|
@ -168,4 +170,4 @@ class LogFilterType extends AbstractType
|
|||
'label' => 'filter.discard',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Filters;
|
||||
|
||||
use App\DataTables\Filters\Constraints\Part\ParameterConstraint;
|
||||
|
@ -277,4 +279,4 @@ class PartFilterType extends AbstractType
|
|||
]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\ProjectSystem;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
@ -27,4 +29,4 @@ class ProjectBOMEntryCollectionType extends AbstractType
|
|||
'label' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\ProjectSystem;
|
||||
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
|
@ -87,4 +89,4 @@ class ProjectBOMEntryType extends AbstractType
|
|||
'data_class' => ProjectBOMEntry::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\ProjectSystem;
|
||||
|
||||
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
|
||||
$lot = new PartLot();
|
||||
$description = 'Build ' . date('Y-m-d H:i:s');
|
||||
if (!empty($data->getComment())) {
|
||||
if ($data->getComment() !== '') {
|
||||
$description .= ' (' . $data->getComment() . ')';
|
||||
}
|
||||
$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
|
||||
$data->setAddBuildsToBuildsPart($forms['addBuildsToBuildsPart']->getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Type;
|
||||
|
||||
use Brick\Math\BigDecimal;
|
||||
|
|
|
@ -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\Form\Type;
|
||||
|
||||
use Brick\Math\BigDecimal;
|
||||
|
|
|
@ -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\Form\Type\Helper;
|
||||
|
||||
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()];
|
||||
}
|
||||
|
||||
|
@ -96,7 +98,7 @@ class StructuralEntityChoiceHelper
|
|||
public function generateChoiceAttrCurrency(Currency $choice, Options|array $options): array
|
||||
{
|
||||
$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();
|
||||
|
||||
return $tmp + [
|
||||
|
@ -147,4 +149,4 @@ class StructuralEntityChoiceHelper
|
|||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Type\Helper;
|
||||
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
|
@ -84,4 +86,4 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader
|
|||
return $this->additional_element;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Type;
|
||||
|
||||
use App\Entity\Parts\Storelocation;
|
||||
|
@ -51,4 +53,4 @@ class PartLotSelectType extends AbstractType
|
|||
->setParameter('part', $options['part'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Type;
|
||||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -122,4 +124,4 @@ class PartSelectType extends AbstractType implements DataMapperInterface
|
|||
$data = $form->getData();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
@ -61,4 +63,4 @@ class RichTextEditorType extends AbstractType
|
|||
{
|
||||
return TextareaType::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
@ -45,4 +47,4 @@ class ThemeChoiceType extends AbstractType
|
|||
]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Form\Type;
|
||||
|
||||
use App\Entity\UserSystem\User;
|
||||
|
@ -40,4 +42,4 @@ class UserSelectType extends AbstractType
|
|||
{
|
||||
return StructuralEntityType::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\Helpers\Projects;
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
|
@ -283,4 +285,4 @@ final class ProjectBuildRequest
|
|||
{
|
||||
return $this->number_of_builds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ final class TreeViewNodeIterator extends ArrayIterator implements RecursiveItera
|
|||
/** @var TreeViewNode $element */
|
||||
$element = $this->current();
|
||||
|
||||
return !empty($element->getNodes());
|
||||
return $element->getNodes() !== null && $element->getNodes() !== [];
|
||||
}
|
||||
|
||||
public function getChildren(): TreeViewNodeIterator
|
||||
|
|
|
@ -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;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
|
|
|
@ -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\Migration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
@ -88,7 +90,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
|
|||
*/
|
||||
public function getInitalAdminPW(): string
|
||||
{
|
||||
if (empty($this->admin_pw)) {
|
||||
if ($this->admin_pw === '') {
|
||||
if (!empty($_ENV['INITIAL_ADMIN_PW'])) {
|
||||
$this->admin_pw = $_ENV['INITIAL_ADMIN_PW'];
|
||||
} else {
|
||||
|
@ -104,7 +106,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
|
|||
{
|
||||
parent::postUp($schema);
|
||||
|
||||
if (!empty($this->admin_pw)) {
|
||||
if ($this->admin_pw !== '') {
|
||||
$this->logger->warning('');
|
||||
$this->logger->warning('<bg=yellow;fg=black>The initial password for the "admin" user is: '.$this->admin_pw.'</>');
|
||||
$this->logger->warning('');
|
||||
|
|
|
@ -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\Repository;
|
||||
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue