Use typed properties

This commit is contained in:
Jan Böhmer 2022-09-18 22:59:31 +02:00
parent 548ec2ea50
commit 51e05a8669
216 changed files with 603 additions and 698 deletions

View file

@ -52,7 +52,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class AmountFormatter
{
protected $siFormatter;
protected SIFormatter $siFormatter;
public function __construct(SIFormatter $siFormatter)
{

View file

@ -55,7 +55,7 @@ use function strlen;
*/
class AttachmentManager
{
protected $pathResolver;
protected AttachmentPathResolver $pathResolver;
public function __construct(AttachmentPathResolver $pathResolver)
{

View file

@ -51,17 +51,17 @@ use Symfony\Component\Filesystem\Filesystem;
*/
class AttachmentPathResolver
{
protected $project_dir;
protected string $project_dir;
protected $media_path;
protected $footprints_path;
protected $models_path;
protected $secure_path;
protected ?string $media_path;
protected ?string $footprints_path;
protected ?string $models_path;
protected ?string $secure_path;
protected $placeholders;
protected $pathes;
protected $placeholders_regex;
protected $pathes_regex;
protected array $placeholders;
protected array $pathes;
protected array $placeholders_regex;
protected array $pathes_regex;
/**
* AttachmentPathResolver constructor.

View file

@ -54,10 +54,10 @@ use Symfony\Component\Filesystem\Filesystem;
*/
class AttachmentReverseSearch
{
protected $em;
protected $pathResolver;
protected $cacheManager;
protected $attachmentURLGenerator;
protected EntityManagerInterface $em;
protected AttachmentPathResolver $pathResolver;
protected CacheManager $cacheManager;
protected AttachmentURLGenerator $attachmentURLGenerator;
public function __construct(EntityManagerInterface $em, AttachmentPathResolver $pathResolver,
CacheManager $cacheManager, AttachmentURLGenerator $attachmentURLGenerator)

View file

@ -74,12 +74,12 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
*/
class AttachmentSubmitHandler
{
protected $pathResolver;
protected $folder_mapping;
protected $allow_attachments_downloads;
protected $httpClient;
protected $mimeTypes;
protected $filterTools;
protected AttachmentPathResolver $pathResolver;
protected array $folder_mapping;
protected bool $allow_attachments_downloads;
protected HttpClientInterface $httpClient;
protected MimeTypesInterface $mimeTypes;
protected FileTypeFilterTools $filterTools;
public function __construct(AttachmentPathResolver $pathResolver, bool $allow_attachments_downloads,
HttpClientInterface $httpClient, MimeTypesInterface $mimeTypes,

View file

@ -53,14 +53,14 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class AttachmentURLGenerator
{
protected $assets;
protected $public_path;
protected $pathResolver;
protected $urlGenerator;
protected $attachmentHelper;
protected $filterService;
protected Packages $assets;
protected string $public_path;
protected AttachmentPathResolver $pathResolver;
protected UrlGeneratorInterface $urlGenerator;
protected AttachmentManager $attachmentHelper;
protected FilterService $filterService;
protected $logger;
protected LoggerInterface $logger;
public function __construct(Packages $assets, AttachmentPathResolver $pathResolver,
UrlGeneratorInterface $urlGenerator, AttachmentManager $attachmentHelper,

View file

@ -53,8 +53,8 @@ use Symfony\Contracts\Cache\CacheInterface;
*/
class BuiltinAttachmentsFinder
{
protected $pathResolver;
protected $cache;
protected AttachmentPathResolver $pathResolver;
protected CacheInterface $cache;
public function __construct(CacheInterface $cache, AttachmentPathResolver $pathResolver)
{

View file

@ -63,8 +63,8 @@ class FileTypeFilterTools
protected const AUDIO_EXTS = ['mp3', 'flac', 'ogg', 'oga', 'wav', 'm4a', 'opus'];
protected const ALLOWED_MIME_PLACEHOLDERS = ['image/*', 'audio/*', 'video/*'];
protected $mimeTypes;
protected $cache;
protected MimeTypesInterface $mimeTypes;
protected CacheInterface $cache;
public function __construct(MimeTypesInterface $mimeTypes, CacheInterface $cache)
{

View file

@ -47,7 +47,7 @@ use App\Entity\Parts\Part;
class PartPreviewGenerator
{
protected $attachmentHelper;
protected AttachmentManager $attachmentHelper;
public function __construct(AttachmentManager $attachmentHelper)
{

View file

@ -67,8 +67,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ElementTypeNameGenerator
{
protected $translator;
protected $mapping;
protected TranslatorInterface $translator;
protected array $mapping;
public function __construct(TranslatorInterface $translator)
{

View file

@ -58,7 +58,7 @@ use Symfony\Component\Serializer\SerializerInterface;
*/
class EntityExporter
{
protected $serializer;
protected SerializerInterface $serializer;
public function __construct(SerializerInterface $serializer)
{

View file

@ -54,9 +54,9 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
class EntityImporter
{
protected $serializer;
protected $em;
protected $validator;
protected SerializerInterface $serializer;
protected EntityManagerInterface $em;
protected ValidatorInterface $validator;
public function __construct(SerializerInterface $serializer, EntityManagerInterface $em, ValidatorInterface $validator)
{

View file

@ -76,11 +76,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
*/
class EntityURLGenerator
{
protected $attachmentURLGenerator;
/**
* @var UrlGeneratorInterface
*/
protected $urlGenerator;
protected UrlGeneratorInterface $urlGenerator;
protected AttachmentURLGenerator $attachmentURLGenerator;
public function __construct(UrlGeneratorInterface $urlGenerator, AttachmentURLGenerator $attachmentURLGenerator)
{

View file

@ -8,8 +8,8 @@ use Swap\Swap;
class ExchangeRateUpdater
{
private $base_currency;
private $swap;
private string $base_currency;
private Swap $swap;
public function __construct(string $base_currency, Swap $swap)
{

View file

@ -46,7 +46,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
class GitVersionInfo
{
protected $project_dir;
protected string $project_dir;
public function __construct(KernelInterface $kernel)
{

View file

@ -30,7 +30,7 @@ use InvalidArgumentException;
final class BarcodeGenerator
{
private $barcodeContentGenerator;
private BarcodeContentGenerator $barcodeContentGenerator;
public function __construct(BarcodeContentGenerator $barcodeContentGenerator)
{

View file

@ -43,7 +43,8 @@ final class BarcodeContentGenerator
PartLot::class => 'lot',
Storelocation::class => 'location',
];
private $urlGenerator;
private UrlGeneratorInterface $urlGenerator;
public function __construct(UrlGeneratorInterface $urlGenerator)
{

View file

@ -31,8 +31,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
final class BarcodeRedirector
{
private $urlGenerator;
private $em;
private UrlGeneratorInterface $urlGenerator;
private EntityManagerInterface $em;
public function __construct(UrlGeneratorInterface $urlGenerator, EntityManagerInterface $entityManager)
{

View file

@ -40,7 +40,7 @@ final class LabelGenerator
public const MM_TO_POINTS_FACTOR = 2.83465;
private $labelHTMLGenerator;
private LabelHTMLGenerator $labelHTMLGenerator;
public function __construct(LabelHTMLGenerator $labelHTMLGenerator)
{

View file

@ -34,13 +34,13 @@ use Twig\Error\Error;
final class LabelHTMLGenerator
{
private $twig;
private $elementTypeNameGenerator;
private $replacer;
private $barcodeGenerator;
private $sandboxedTwigProvider;
private $partdb_title;
private $security;
private Environment $twig;
private ElementTypeNameGenerator $elementTypeNameGenerator;
private LabelTextReplacer $replacer;
private BarcodeGenerator $barcodeGenerator;
private SandboxedTwigProvider $sandboxedTwigProvider;
private string $partdb_title;
private Security $security;
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, LabelTextReplacer $replacer, Environment $twig,
BarcodeGenerator $barcodeGenerator, SandboxedTwigProvider $sandboxedTwigProvider, Security $security, string $partdb_title)

View file

@ -32,9 +32,9 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface;
final class LabelProfileDropdownHelper
{
private $cache;
private $entityManager;
private $keyGenerator;
private TagAwareCacheInterface $cache;
private EntityManagerInterface $entityManager;
private UserCacheKeyGenerator $keyGenerator;
public function __construct(TagAwareCacheInterface $treeCache, EntityManagerInterface $entityManager, UserCacheKeyGenerator $keyGenerator)
{

View file

@ -31,7 +31,7 @@ use App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface;
*/
final class LabelTextReplacer
{
private $providers;
private iterable $providers;
public function __construct(iterable $providers)
{

View file

@ -28,7 +28,7 @@ use App\Services\ElementTypeNameGenerator;
final class AbstractDBElementProvider implements PlaceholderProviderInterface
{
private $elementTypeNameGenerator;
private ElementTypeNameGenerator $elementTypeNameGenerator;
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator)
{

View file

@ -34,8 +34,8 @@ use Symfony\Component\Security\Core\Security;
*/
final class GlobalProviders implements PlaceholderProviderInterface
{
private $partdb_title;
private $security;
private string $partdb_title;
private Security $security;
public function __construct(string $partdb_title, Security $security)
{

View file

@ -31,8 +31,8 @@ use Locale;
final class PartLotProvider implements PlaceholderProviderInterface
{
private $labelTextReplacer;
private $amountFormatter;
private LabelTextReplacer $labelTextReplacer;
private AmountFormatter $amountFormatter;
public function __construct(LabelTextReplacer $labelTextReplacer, AmountFormatter $amountFormatter)
{

View file

@ -30,8 +30,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class PartProvider implements PlaceholderProviderInterface
{
private $siFormatter;
private $translator;
private SIFormatter $siFormatter;
private TranslatorInterface $translator;
public function __construct(SIFormatter $SIFormatter, TranslatorInterface $translator)
{

View file

@ -96,7 +96,7 @@ final class SandboxedTwigProvider
];
private const ALLOWED_PROPERTIES = [];
private $appExtension;
private FormatExtension $appExtension;
public function __construct(FormatExtension $appExtension)
{

View file

@ -27,7 +27,7 @@ class EventCommentHelper
{
protected const MAX_MESSAGE_LENGTH = 255;
protected $message;
protected ?string $message;
public function __construct()
{

View file

@ -49,11 +49,11 @@ use Symfony\Component\Security\Core\Security;
class EventLogger
{
protected $minimum_log_level;
protected $blacklist;
protected $whitelist;
protected $em;
protected $security;
protected int $minimum_log_level;
protected array $blacklist;
protected array $whitelist;
protected EntityManagerInterface $em;
protected Security $security;
public function __construct(int $minimum_log_level, array $blacklist, array $whitelist, EntityManagerInterface $em, Security $security)
{

View file

@ -33,8 +33,8 @@ class EventUndoHelper
protected const ALLOWED_MODES = [self::MODE_REVERT, self::MODE_UNDO];
protected $undone_event;
protected $mode;
protected ?AbstractLogEntry $undone_event;
protected string $mode;
public function __construct()
{

View file

@ -66,8 +66,8 @@ class LogEntryExtraFormatter
{
protected const CONSOLE_SEARCH = ['<i class="fas fa-long-arrow-alt-right"></i>', '<i>', '</i>', '<b>', '</b>'];
protected const CONSOLE_REPLACE = ['→', '<info>', '</info>', '<error>', '</error>'];
protected $translator;
protected $elementTypeNameGenerator;
protected TranslatorInterface $translator;
protected ElementTypeNameGenerator $elementTypeNameGenerator;
public function __construct(TranslatorInterface $translator, ElementTypeNameGenerator $elementTypeNameGenerator)
{

View file

@ -32,6 +32,7 @@ use App\Entity\Contracts\TimeTravelInterface;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\LogSystem\CollectionElementDeleted;
use App\Entity\LogSystem\ElementEditedLogEntry;
use App\Repository\LogEntryRepository;
use Brick\Math\BigDecimal;
use DateTime;
use Doctrine\Common\Collections\Collection;
@ -44,8 +45,8 @@ use ReflectionClass;
class TimeTravel
{
protected $em;
protected $repo;
protected EntityManagerInterface $em;
protected LogEntryRepository $repo;
public function __construct(EntityManagerInterface $em)
{

View file

@ -49,7 +49,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class MarkdownParser
{
protected $translator;
protected TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{

View file

@ -48,8 +48,8 @@ use NumberFormatter;
class MoneyFormatter
{
protected $base_currency;
protected $locale;
protected string $base_currency;
protected string $locale;
public function __construct(string $base_currency)
{

View file

@ -34,8 +34,8 @@ use Symfony\Component\Security\Core\Security;
final class PartsTableActionHandler
{
private $entityManager;
private $security;
private EntityManagerInterface $entityManager;
private Security $security;
public function __construct(EntityManagerInterface $entityManager, Security $security)
{

View file

@ -51,15 +51,16 @@ use Symfony\Component\Mime\Address;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\PasswordHasher\PasswordHasherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class PasswordResetManager
{
protected $mailer;
protected $em;
protected $passwordEncoder;
protected $translator;
protected $userPasswordEncoder;
protected MailerInterface $mailer;
protected EntityManagerInterface $em;
protected PasswordHasherInterface $passwordEncoder;
protected TranslatorInterface $translator;
protected UserPasswordHasherInterface $userPasswordEncoder;
public function __construct(MailerInterface $mailer, EntityManagerInterface $em,
TranslatorInterface $translator, UserPasswordHasherInterface $userPasswordEncoder,

View file

@ -56,8 +56,8 @@ class PermissionResolver
{
protected $permission_structure;
protected $is_debug;
protected $cache_file;
protected bool $is_debug;
protected string $cache_file;
/**
* PermissionResolver constructor.

View file

@ -54,8 +54,8 @@ use function count;
class PricedetailHelper
{
protected $base_currency;
protected $locale;
protected string $base_currency;
protected string $locale;
public function __construct(string $base_currency)
{

View file

@ -34,6 +34,8 @@ use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Repository\AttachmentRepository;
use App\Repository\PartRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NonUniqueResultException;
@ -42,9 +44,9 @@ use InvalidArgumentException;
class StatisticsHelper
{
protected $em;
protected $part_repo;
protected $attachment_repo;
protected EntityManagerInterface $em;
protected PartRepository $part_repo;
protected AttachmentRepository $attachment_repo;
public function __construct(EntityManagerInterface $em)
{

View file

@ -47,7 +47,7 @@ use Doctrine\ORM\EntityManagerInterface;
class StructuralElementRecursionHelper
{
protected $em;
protected EntityManagerInterface $em;
public function __construct(EntityManagerInterface $em)
{

View file

@ -50,8 +50,8 @@ use RuntimeException;
*/
class BackupCodeGenerator
{
protected $code_length;
protected $code_count;
protected int $code_length;
protected int $code_count;
/**
* BackupCodeGenerator constructor.

View file

@ -49,7 +49,7 @@ use App\Entity\UserSystem\User;
*/
class BackupCodeManager
{
protected $backupCodeGenerator;
protected BackupCodeGenerator $backupCodeGenerator;
public function __construct(BackupCodeGenerator $backupCodeGenerator)
{

View file

@ -53,7 +53,7 @@ use function array_slice;
*/
class TagFinder
{
protected $em;
protected EntityManagerInterface $em;
public function __construct(EntityManagerInterface $entityManager)
{

View file

@ -52,8 +52,8 @@ use Symfony\Component\Translation\MessageCatalogue;
*/
final class PermissionExtractor implements ExtractorInterface
{
private $permission_structure;
private $finished = false;
private array $permission_structure;
private bool $finished = false;
public function __construct(PermissionResolver $resolver)
{

View file

@ -54,9 +54,9 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface;
*/
class NodesListBuilder
{
protected $em;
protected $cache;
protected $keyGenerator;
protected EntityManagerInterface $em;
protected TagAwareCacheInterface $cache;
protected UserCacheKeyGenerator $keyGenerator;
public function __construct(EntityManagerInterface $em, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator)
{

View file

@ -70,11 +70,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class ToolsTreeBuilder
{
protected $translator;
protected $urlGenerator;
protected $keyGenerator;
protected $cache;
protected $security;
protected TranslatorInterface $translator;
protected UrlGeneratorInterface $urlGenerator;
protected UserCacheKeyGenerator $keyGenerator;
protected TagAwareCacheInterface $cache;
protected Security $security;
public function __construct(TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator,
TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator,

View file

@ -51,7 +51,7 @@ use Symfony\Component\Security\Core\Security;
*/
class UserCacheKeyGenerator
{
protected $security;
protected Security $security;
public function __construct(Security $security)
{