Fixed some more inspection issues

This commit is contained in:
Jan Böhmer 2023-04-15 22:05:29 +02:00
parent de96aae9a5
commit 29d1d49aca
83 changed files with 153 additions and 172 deletions

View file

@ -443,11 +443,13 @@ class AttachmentSubmitHandler
];
if (ctype_digit((string) $maxSize)) {
return (int) $maxSize;
} elseif (preg_match('/^(\d++)('.implode('|', array_keys($factors)).')$/i', $maxSize, $matches)) {
return (((int) $matches[1]) * $factors[strtolower($matches[2])]);
} else {
throw new RuntimeException(sprintf('"%s" is not a valid maximum size.', $maxSize));
}
if (preg_match('/^(\d++)('.implode('|', array_keys($factors)).')$/i', $maxSize, $matches)) {
return (((int) $matches[1]) * $factors[strtolower($matches[2])]);
}
throw new RuntimeException(sprintf('"%s" is not a valid maximum size.', $maxSize));
}
/*

View file

@ -114,7 +114,7 @@ class BOMImporter
foreach ($csv->getRecords() as $offset => $entry) {
//Translate the german field names to english
$entry = array_combine(array_map(function ($key) {
$entry = array_combine(array_map(static function ($key) {
return self::MAP_KICAD_PCB_FIELDS[$key] ?? $key;
}, array_keys($entry)), $entry);

View file

@ -41,6 +41,8 @@ declare(strict_types=1);
namespace App\Services\LabelSystem;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\LabelSystem\LabelOptions;
use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator;
use Com\Tecnick\Barcode\Barcode;
@ -125,7 +127,7 @@ final class BarcodeGenerator
return $bobj->getSvgCode();
}
public function getContent(LabelOptions $options, object $target): ?string
public function getContent(LabelOptions $options, AbstractDBElement $target): ?string
{
switch ($options->getBarcodeType()) {
case 'qr':

View file

@ -49,14 +49,14 @@ use function count;
class TreeViewGenerator
{
protected $urlGenerator;
protected $em;
protected $cache;
protected $keyGenerator;
protected $translator;
protected EntityURLGenerator $urlGenerator;
protected EntityManagerInterface $em;
protected TagAwareCacheInterface $cache;
protected UserCacheKeyGenerator $keyGenerator;
protected TranslatorInterface $translator;
protected $rootNodeExpandedByDefault;
protected $rootNodeEnabled;
protected bool $rootNodeExpandedByDefault;
protected bool $rootNodeEnabled;
public function __construct(EntityURLGenerator $URLGenerator, EntityManagerInterface $em,
TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, TranslatorInterface $translator, bool $rootNodeExpandedByDefault, bool $rootNodeEnabled)

View file

@ -36,11 +36,7 @@ class PermissionSchemaUpdater
{
$perm_data = $holder->getPermissions();
if ($perm_data->getSchemaVersion() < PermissionData::CURRENT_SCHEMA_VERSION) {
return true;
}
return false;
return $perm_data->getSchemaVersion() < PermissionData::CURRENT_SCHEMA_VERSION;
}
/**