Applied rector with PHP8.1 migration rules

This commit is contained in:
Jan Böhmer 2023-06-11 14:15:46 +02:00
parent dc6a67c2f0
commit 7ee01d9a05
303 changed files with 1228 additions and 3465 deletions

View file

@ -27,13 +27,8 @@ use Swap\Swap;
class ExchangeRateUpdater
{
private string $base_currency;
private Swap $swap;
public function __construct(string $base_currency, Swap $swap)
public function __construct(private readonly string $base_currency, private readonly Swap $swap)
{
$this->base_currency = $base_currency;
$this->swap = $swap;
}
/**

View file

@ -62,13 +62,11 @@ use InvalidArgumentException;
class StatisticsHelper
{
protected EntityManagerInterface $em;
protected PartRepository $part_repo;
protected AttachmentRepository $attachment_repo;
public function __construct(EntityManagerInterface $em)
public function __construct(protected EntityManagerInterface $em)
{
$this->em = $em;
$this->part_repo = $this->em->getRepository(Part::class);
$this->attachment_repo = $this->em->getRepository(Attachment::class);
}

View file

@ -34,11 +34,8 @@ use function array_slice;
*/
class TagFinder
{
protected EntityManagerInterface $em;
public function __construct(EntityManagerInterface $entityManager)
public function __construct(protected EntityManagerInterface $em)
{
$this->em = $entityManager;
}
/**
@ -78,7 +75,7 @@ class TagFinder
//Iterate over each possible tags (which are comma separated) and extract tags which match our keyword
foreach ($possible_tags as $tags) {
$tags = explode(',', $tags['tags']);
$tags = explode(',', (string) $tags['tags']);
$results = array_merge($results, preg_grep($keyword_regex, $tags));
}