Skip to content

Commit b6ef435

Browse files
committed
use constructor property promotion
1 parent 1b8974c commit b6ef435

File tree

7 files changed

+24
-38
lines changed

7 files changed

+24
-38
lines changed

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

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
/**

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

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
/**

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

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

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

0 commit comments

Comments
 (0)