Skip to content

Commit 4c0217d

Browse files
author
Six
committed
Added readonly
All classes can be readonly.
1 parent 954ab23 commit 4c0217d

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/AbstractStrategy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
* @template T
1414
* @implements IteratorAggregate<int, list<T>>
1515
*/
16-
abstract class AbstractStrategy implements Countable, IteratorAggregate
16+
abstract readonly class AbstractStrategy implements Countable, IteratorAggregate
1717
{
1818
/** @var list<T> */
19-
protected readonly array $elements;
19+
protected array $elements;
2020

2121
/** @var int<0, max> */
22-
protected readonly int $n;
22+
protected int $n;
2323

2424
/** @var int<1, max> */
25-
protected readonly int $k;
25+
protected int $k;
2626

2727
/**
2828
* @param array<array-key, T> $elements

src/Combination/WithRepetition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @template T
1212
* @extends AbstractStrategy<T>
1313
*/
14-
final class WithRepetition extends AbstractStrategy
14+
final readonly class WithRepetition extends AbstractStrategy
1515
{
1616
#[Override]
1717
protected function next(array $elements, int $i): array

src/Combination/WithoutRepetition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @template T
1313
* @extends AbstractStrategy<T>
1414
*/
15-
final class WithoutRepetition extends AbstractStrategy
15+
final readonly class WithoutRepetition extends AbstractStrategy
1616
{
1717
#[Override]
1818
protected function assertValid(): void

src/Permutation/WithRepetition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @template T
1111
* @extends AbstractStrategy<T>
1212
*/
13-
final class WithRepetition extends AbstractStrategy
13+
final readonly class WithRepetition extends AbstractStrategy
1414
{
1515
#[Override]
1616
protected function next(array $elements, int $i): array

src/Permutation/WithoutRepetition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @template T
1212
* @extends AbstractStrategy<T>
1313
*/
14-
final class WithoutRepetition extends AbstractStrategy
14+
final readonly class WithoutRepetition extends AbstractStrategy
1515
{
1616
#[Override]
1717
protected function assertValid(): void

0 commit comments

Comments
 (0)