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

@ -50,7 +50,7 @@ use Twig\TwigFunction;
final class UserExtension extends AbstractExtension
{
private LogEntryRepository $repo;
private readonly LogEntryRepository $repo;
public function __construct(EntityManagerInterface $em)
{
@ -60,7 +60,7 @@ final class UserExtension extends AbstractExtension
public function getFilters(): array
{
return [
new TwigFilter('remove_locale_from_path', [$this, 'removeLocaleFromPath']),
new TwigFilter('remove_locale_from_path', fn(string $path): string => $this->removeLocaleFromPath($path)),
];
}
@ -68,9 +68,9 @@ final class UserExtension extends AbstractExtension
{
return [
/* Returns the user which has edited the given entity the last time. */
new TwigFunction('last_editing_user', [$this->repo, 'getLastEditingUser']),
new TwigFunction('last_editing_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getLastEditingUser($element)),
/* Returns the user which has created the given entity. */
new TwigFunction('creating_user', [$this->repo, 'getCreatingUser']),
new TwigFunction('creating_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getCreatingUser($element)),
];
}