Skip to content

Commit 6609544

Browse files
committed
minor symfony#57107 [AssetMapper][Intl][Mailer][Process][RateLimiter][Translation][WebLink] use constructor property promotion (xabbuh)
This PR was merged into the 7.2 branch. Discussion ---------- [AssetMapper][Intl][Mailer][Process][RateLimiter][Translation][WebLink] use constructor property promotion | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 943d430 use constructor property promotion
2 parents f6a5cbd + 943d430 commit 6609544

File tree

61 files changed

+281
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+281
-432
lines changed

src/Symfony/Component/AssetMapper/Event/PreAssetsCompileEvent.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
*/
2222
class PreAssetsCompileEvent extends Event
2323
{
24-
private OutputInterface $output;
25-
26-
public function __construct(OutputInterface $output)
27-
{
28-
$this->output = $output;
24+
public function __construct(
25+
private OutputInterface $output,
26+
) {
2927
}
3028

3129
public function getOutput(): OutputInterface

src/Symfony/Component/AssetMapper/MappedAsset.php

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,11 @@ final class MappedAsset
3434

3535
public readonly string $digest;
3636
public readonly bool $isPredigested;
37-
public readonly bool $isVendor;
3837

3938
/**
40-
* Assets whose content affects the content of this asset.
41-
*
42-
* @var MappedAsset[]
43-
*/
44-
private array $dependencies = [];
45-
46-
/**
47-
* @var string[]
48-
*/
49-
private array $fileDependencies = [];
50-
51-
/**
52-
* @var JavaScriptImport[]
53-
*/
54-
private array $javaScriptImports = [];
55-
56-
/**
57-
* @param MappedAsset[] $dependencies assets that the content of this asset depends on
58-
* @param string[] $fileDependencies files that the content of this asset depends on
39+
* @param MappedAsset[] $dependencies assets that the content of this asset depends on
40+
* @param string[] $fileDependencies files that the content of this asset depends on
41+
* @param JavaScriptImport[] $javaScriptImports
5942
*/
6043
public function __construct(
6144
public readonly string $logicalPath,
@@ -65,10 +48,10 @@ public function __construct(
6548
?string $content = null,
6649
?string $digest = null,
6750
?bool $isPredigested = null,
68-
bool $isVendor = false,
69-
array $dependencies = [],
70-
array $fileDependencies = [],
71-
array $javaScriptImports = [],
51+
public readonly bool $isVendor = false,
52+
private array $dependencies = [],
53+
private array $fileDependencies = [],
54+
private array $javaScriptImports = [],
7255
) {
7356
if (null !== $sourcePath) {
7457
$this->sourcePath = $sourcePath;
@@ -87,10 +70,6 @@ public function __construct(
8770
if (null !== $isPredigested) {
8871
$this->isPredigested = $isPredigested;
8972
}
90-
$this->isVendor = $isVendor;
91-
$this->dependencies = $dependencies;
92-
$this->fileDependencies = $fileDependencies;
93-
$this->javaScriptImports = $javaScriptImports;
9473
}
9574

9675
/**

src/Symfony/Component/Intl/Data/Bundle/Reader/BufferedBundleReader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
*/
2121
class BufferedBundleReader implements BundleReaderInterface
2222
{
23-
private BundleReaderInterface $reader;
2423
/** @var RingBuffer<string, mixed> */
2524
private RingBuffer $buffer;
2625

27-
public function __construct(BundleReaderInterface $reader, int $bufferSize)
28-
{
29-
$this->reader = $reader;
26+
public function __construct(
27+
private BundleReaderInterface $reader,
28+
int $bufferSize,
29+
) {
3030
$this->buffer = new RingBuffer($bufferSize);
3131
}
3232

src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
*/
2929
class BundleEntryReader implements BundleEntryReaderInterface
3030
{
31-
private BundleReaderInterface $reader;
32-
3331
/**
3432
* A mapping of locale aliases to locales.
3533
*/
@@ -38,9 +36,9 @@ class BundleEntryReader implements BundleEntryReaderInterface
3836
/**
3937
* Creates an entry reader based on the given resource bundle reader.
4038
*/
41-
public function __construct(BundleReaderInterface $reader)
42-
{
43-
$this->reader = $reader;
39+
public function __construct(
40+
private BundleReaderInterface $reader,
41+
) {
4442
}
4543

4644
/**

src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
*/
2828
abstract class AbstractDataGenerator
2929
{
30-
private BundleCompilerInterface $compiler;
31-
private string $dirName;
32-
33-
public function __construct(BundleCompilerInterface $compiler, string $dirName)
34-
{
35-
$this->compiler = $compiler;
36-
$this->dirName = $dirName;
30+
public function __construct(
31+
private BundleCompilerInterface $compiler,
32+
private string $dirName,
33+
) {
3734
}
3835

3936
public function generateData(GeneratorConfig $config): void

src/Symfony/Component/Intl/Data/Generator/GeneratorConfig.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,15 @@
2222
*/
2323
class GeneratorConfig
2424
{
25-
private string $sourceDir;
26-
private string $icuVersion;
27-
2825
/**
2926
* @var BundleWriterInterface[]
3027
*/
3128
private array $bundleWriters = [];
3229

33-
public function __construct(string $sourceDir, string $icuVersion)
34-
{
35-
$this->sourceDir = $sourceDir;
36-
$this->icuVersion = $icuVersion;
30+
public function __construct(
31+
private string $sourceDir,
32+
private string $icuVersion,
33+
) {
3734
}
3835

3936
/**

src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@
2525
*/
2626
class ArrayAccessibleResourceBundle implements \ArrayAccess, \IteratorAggregate, \Countable
2727
{
28-
private \ResourceBundle $bundleImpl;
29-
30-
public function __construct(\ResourceBundle $bundleImpl)
31-
{
32-
$this->bundleImpl = $bundleImpl;
28+
public function __construct(
29+
private \ResourceBundle $bundleImpl,
30+
) {
3331
}
3432

3533
public function get(int|string $offset): mixed

src/Symfony/Component/Intl/Data/Util/RingBuffer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ class RingBuffer implements \ArrayAccess
3636
/** @var array<TKey, int> */
3737
private array $indices = [];
3838
private int $cursor = 0;
39-
private int $size;
4039

41-
public function __construct(int $size)
42-
{
43-
$this->size = $size;
40+
public function __construct(
41+
private int $size,
42+
) {
4443
}
4544

4645
public function offsetExists(mixed $key): bool

src/Symfony/Component/Intl/Util/GitRepository.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@
1919
*/
2020
final class GitRepository
2121
{
22-
private string $path;
23-
24-
public function __construct(string $path)
25-
{
26-
$this->path = $path;
27-
22+
public function __construct(
23+
private string $path,
24+
) {
2825
$this->getUrl();
2926
}
3027

src/Symfony/Component/Mailer/DelayedEnvelope.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ final class DelayedEnvelope extends Envelope
2525
{
2626
private bool $senderSet = false;
2727
private bool $recipientsSet = false;
28-
private Message $message;
2928

30-
public function __construct(Message $message)
31-
{
32-
$this->message = $message;
29+
public function __construct(
30+
private Message $message,
31+
) {
3332
}
3433

3534
public function setSender(Address $sender): void

0 commit comments

Comments
 (0)