Migrated all constructor props to property promotion when possible

This commit is contained in:
Alejandro Celaya
2021-05-23 11:57:31 +02:00
parent 4b5fa6ddad
commit e0f0bb5523
118 changed files with 237 additions and 713 deletions

View File

@@ -12,11 +12,8 @@ use function Symfony\Component\String\s;
class CocurSymfonySluggerBridge implements SluggerInterface
{
private SlugifyInterface $slugger;
public function __construct(SlugifyInterface $slugger)
public function __construct(private SlugifyInterface $slugger)
{
$this->slugger = $slugger;
}
public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString

View File

@@ -12,11 +12,8 @@ use Throwable;
*/
class DoctrineBatchHelper implements DoctrineBatchHelperInterface
{
private EntityManagerInterface $em;
public function __construct(EntityManagerInterface $em)
public function __construct(private EntityManagerInterface $em)
{
$this->em = $em;
}
/**

View File

@@ -13,11 +13,8 @@ use function sprintf;
class RedirectResponseHelper implements RedirectResponseHelperInterface
{
private UrlShortenerOptions $options;
public function __construct(UrlShortenerOptions $options)
public function __construct(private UrlShortenerOptions $options)
{
$this->options = $options;
}
public function buildRedirectResponse(string $location): ResponseInterface

View File

@@ -23,13 +23,8 @@ class UrlValidator implements UrlValidatorInterface, RequestMethodInterface
private const CHROME_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
. 'Chrome/51.0.2704.103 Safari/537.36';
private ClientInterface $httpClient;
private UrlShortenerOptions $options;
public function __construct(ClientInterface $httpClient, UrlShortenerOptions $options)
public function __construct(private ClientInterface $httpClient, private UrlShortenerOptions $options)
{
$this->httpClient = $httpClient;
$this->options = $options;
}
/**