8000 minor #42202 [Translation] add types to private properties (rvanlaak) · symfony/symfony@a1ec2d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a1ec2d5

Browse files
minor #42202 [Translation] add types to private properties (rvanlaak)
This PR was merged into the 6.0 branch. Discussion ---------- [Translation] add types to private properties | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A | License | MIT | Doc PR | N/A Saw `@derrabus` creating PRs that add types to private properties for other components (#42179, #42109, #42146), so figured out that I could help with the translation component. Could not find a related ticket with an overview / list of TODOs (?) Did only add types where certain, there are several places (like `YamlFileLoader`) where the type gets set after the constructor. Commits ------- 951c569 [Translation] add types to private properties
2 parents 4d571c5 + 951c569 commit a1ec2d5

34 files changed

+125
-159
lines changed

src/Symfony/Component/Translation/Bridge/Crowdin/CrowdinProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
*/
3434
final class CrowdinProvider implements ProviderInterface
3535
{
36-
private $client;
37-
private $loader;
38-
private $logger;
39-
private $xliffFileDumper;
40-
private $defaultLocale;
41-
private $endpoint;
36+
private HttpClientInterface $client;
37+
private LoaderInterface $loader;
38+
private LoggerInterface $logger;
39+
private XliffFileDumper $xliffFileDumper;
40+
private string $defaultLocale;
41+
private string $endpoint;
4242

4343
public function __construct(HttpClientInterface $client, LoaderInterface $loader, LoggerInterface $logger, XliffFileDumper $xliffFileDumper, string $defaultLocale, string $endpoint)
4444
{

src/Symfony/Component/Translation/Bridge/Crowdin/CrowdinProviderFactory.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,11 @@ final class CrowdinProviderFactory extends AbstractProviderFactory
2929
{
3030
private const HOST = 'api.crowdin.com';
3131

32-
/** @var LoaderInterface */
33-
private $loader;
34-
35-
/** @var HttpClientInterface */
36-
private $client;
37-
38-
/** @var LoggerInterface */
39-
private $logger;
40-
41-
/** @var string */
42-
private $defaultLocale;
43-
44-
/** @var XliffFileDumper */
45-
private $xliffFileDumper;
32+
private LoaderInterface $loader;
33+
private HttpClientInterface $client;
34+
private LoggerInterface $logger;
35+
private string $defaultLocale;
36+
private XliffFileDumper $xliffFileDumper;
4637

4738
public function __construct(HttpClientInterface $client, LoggerInterface $logger, string $defaultLocale, LoaderInterface $loader, XliffFileDumper $xliffFileDumper)
4839
{

src/Symfony/Component/Translation/Bridge/Loco/LocoProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
*/
3232
final class LocoProvider implements ProviderInterface
3333
{
34-
private $client;
35-
private $loader;
36-
private $logger;
37-
private $defaultLocale;
38-
private $endpoint;
34+
private HttpClientInterface $client;
35+
private LoaderInterface $loader;
36+
private LoggerInterface $logger;
37+
private string $defaultLocale;
38+
private string $endpoint;
3939

4040
public function __construct(HttpClientInterface $client, LoaderInterface $loader, LoggerInterface $logger, string $defaultLocale, string $endpoint)
4141
{

src/Symfony/Component/Translation/Bridge/Loco/LocoProviderFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ final class LocoProviderFactory extends AbstractProviderFactory
2727
{
2828
private const HOST = 'localise.biz';
2929

30-
private $client;
31-
private $logger;
32-
private $defaultLocale;
33-
private $loader;
30+
private HttpClientInterface $client;
31+
private LoggerInterface $logger;
32+
private string $defaultLocale;
33+
private LoaderInterface $loader;
3434

3535
public function __construct(HttpClientInterface $client, LoggerInterface $logger, string $defaultLocale, LoaderInterface $loader)
3636
{

src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
*/
3333
final class LokaliseProvider implements ProviderInterface
3434
{
35-
private $client;
36-
private $loader;
37-
private $logger;
38-
private $defaultLocale;
39-
private $endpoint;
35+
private HttpClientInterface $client;
36+
private LoaderInterface $loader;
37+
private LoggerInterface $logger;
38+
private string $defaultLocale;
39+
private string $endpoint;
4040

4141
public function __construct(HttpClientInterface $client, LoaderInterface $loader, LoggerInterface $logger, string $defaultLocale, string $endpoint)
4242
{

src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProviderFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ final class LokaliseProviderFactory extends AbstractProviderFactory
2727
{
2828
private const HOST = 'api.lokalise.com';
2929

30-
private $client;
31-
private $logger;
32-
private $defaultLocale;
33-
private $loader;
30+
private HttpClientInterface $client;
31+
private LoggerInterface $logger;
32+
private string $defaultLocale;
33+
private LoaderInterface $loader;
3434

3535
public function __construct(HttpClientInterface $client, LoggerInterface $logger, string $defaultLocale, LoaderInterface $loader)
3636
{

src/Symfony/Component/Translation/Command/TranslationPullCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ final class TranslationPullCommand extends Command
3535
protected static $defaultName = 'translation:pull';
3636
protected static $defaultDescription = 'Pull translations from a given provider.';
3737

38-
private $providerCollection;
39-
private $writer;
40-
private $reader;
41-
private $defaultLocale;
42-
private $transPaths;
43-
private $enabledLocales;
38+
private TranslationProviderCollection $providerCollection;
39+
private TranslationWriterInterface $writer;
40+
private TranslationReaderInterface $reader;
41+
private string $defaultLocale;
42+
private array $transPaths;
43+
private array $enabledLocales;
4444

4545
public function __construct(TranslationProviderCollection $providerCollection, TranslationWriterInterface $writer, TranslationReaderInterface $reader, string $defaultLocale, array $transPaths = [], array $enabledLocales = [])
4646
{

src/Symfony/Component/Translation/Command/TranslationPushCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ final class TranslationPushCommand extends Command
3434
protected static $defaultName = 'translation:push';
3535
protected static $defaultDescription = 'Push 10000 translations to a given provider.';
3636

37-
private $providers;
38-
private $reader;
39-
private $transPaths;
40-
private $enabledLocales;
37+
private TranslationProviderCollection $providers;
38+
private TranslationReaderInterface $reader;
39+
private array $transPaths;
40+
private array $enabledLocales;
4141

4242
public function __construct(TranslationProviderCollection $providers, TranslationReaderInterface $reader, array $transPaths = [], array $enabledLocales = [])
4343
{

src/Symfony/Component/Translation/Command/XliffLintCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ class XliffLintCommand extends Command
3434
protected static $defaultName = 'lint:xliff';
3535
protected static $defaultDescription = 'Lint an XLIFF file and outputs encountered errors';
3636

37-
private $format;
38-
private $displayCorrectFiles;
39-
private $directoryIteratorProvider;
40-
private $isReadableProvider;
41-
private $requireStrictFileNames;
37+
private string $format;
38+
private bool $displayCorrectFiles;
39+
private ?\Closure $directoryIteratorProvider;
40+
private ?\Closure $isReadableProvider;
41+
private bool $requireStrictFileNames;
4242

4343
public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null, bool $requireStrictFileNames = true)
4444
{
4545
parent::__construct($name);
4646

47-
$this->directoryIteratorProvider = $directoryIteratorProvider;
48-
$this->isReadableProvider = $isReadableProvider;
47+
$this->directoryIteratorProvider = null === $directoryIteratorProvider || $directoryIteratorProvider instanceof \Closure ? $directoryIteratorProvider : \Closure::fromCallable($directoryIteratorProvider);
48+
$this->isReadableProvider = null === $isReadableProvider || $isReadableProvider instanceof \Closure ? $isReadableProvider : \Closure::fromCallable($isReadableProvider);
4949
$this->requireStrictFileNames = $requireStrictFileNames;
5050
}
5151

src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface
2727
{
28-
private $translator;
28+
private DataCollectorTranslator $translator;
2929

3030
public function __construct(DataCollectorTranslator $translator)
3131
{

0 commit comments

Comments
 (0)
0