Skip to content

Commit 10bd170

Browse files
authored
refactor: Update code with Rector (#1465)
1 parent 33ffa5f commit 10bd170

File tree

9 files changed

+26
-29
lines changed

9 files changed

+26
-29
lines changed

rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
])
2323
->withSkip([
2424
\Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector::class,
25-
\Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector::class,
2625
\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => [
2726
__DIR__.'/src/Configuration/Configuration.php',
2827
],

src/Annotation/DocblockAnnotationParser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@
2828
/**
2929
* @private
3030
*/
31-
final class DocblockAnnotationParser
31+
final readonly class DocblockAnnotationParser
3232
{
3333
/**
3434
* @var array<string, mixed>
3535
*/
36-
private readonly array $ignoredAnnotationsAsKeys;
36+
private array $ignoredAnnotationsAsKeys;
3737

3838
/**
3939
* @param string[] $ignoredAnnotations
4040
*/
4141
public function __construct(
42-
private readonly DocBlockFactoryInterface $factory,
43-
private readonly Formatter $tagsFormatter,
42+
private DocBlockFactoryInterface $factory,
43+
private Formatter $tagsFormatter,
4444
array $ignoredAnnotations,
4545
) {
4646
$this->ignoredAnnotationsAsKeys = array_flip($ignoredAnnotations);

src/Compactor/Placeholder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
use function array_keys;
1919
use function str_replace;
2020

21-
final class Placeholder implements Compactor
21+
final readonly class Placeholder implements Compactor
2222
{
2323
/**
2424
* @var scalar[]
2525
*/
26-
private readonly array $placeholders;
26+
private array $placeholders;
2727

2828
/**
2929
* @param scalar[] $placeholders

src/Composer/ComposerProcessFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function create(
5050
*/
5151
public function __construct(
5252
private readonly Closure $composerExecutableFactory,
53-
private ?string $verbosity,
53+
private readonly ?string $verbosity,
5454
private readonly bool $ansi,
5555
private readonly array $defaultEnvironmentVariables,
5656
) {

src/Configuration/Configuration.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@
3030
use KevinGH\Box\Composer\Artifact\ComposerJson;
3131
use KevinGH\Box\Composer\Artifact\ComposerLock;
3232
use KevinGH\Box\Composer\ComposerConfiguration;
33-
use KevinGH\Box\Json\Json;
3433
use KevinGH\Box\MapFile;
3534
use KevinGH\Box\Phar\CompressionAlgorithm;
3635
use KevinGH\Box\Phar\SigningAlgorithm;
3736
use KevinGH\Box\PhpScoper\ConfigurationFactory as PhpScoperConfigurationFactory;
3837
use KevinGH\Box\PhpScoper\SerializableScoper;
39-
use Phar;
4038
use RuntimeException;
4139
use SplFileInfo;
4240
use stdClass;

src/DockerFileGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/**
3131
* @private
3232
*/
33-
final class DockerFileGenerator
33+
final readonly class DockerFileGenerator
3434
{
3535
private const FILE_TEMPLATE = <<<'Dockerfile'
3636
FROM php:__BASE_PHP_IMAGE_TOKEN__
@@ -56,12 +56,12 @@ final class DockerFileGenerator
5656
'*' => 'to-define-manually',
5757
];
5858

59-
private readonly string $image;
59+
private string $image;
6060

6161
/**
6262
* @var string[]
6363
*/
64-
private readonly array $extensions;
64+
private array $extensions;
6565

6666
/**
6767
* Creates a new instance of the generator.
@@ -87,7 +87,7 @@ public static function createForRequirements(array $requirements, string $source
8787
public function __construct(
8888
string $image,
8989
array $extensions,
90-
private readonly string $sourcePhar,
90+
private string $sourcePhar,
9191
) {
9292
Assert::inArray($image, self::PHP_DOCKER_IMAGES);
9393
Assert::allString($extensions);

src/Phar/PharDiff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
/**
2222
* @internal
2323
*/
24-
final class PharDiff
24+
final readonly class PharDiff
2525
{
26-
private readonly PharInfo $pharInfoA;
27-
private readonly PharInfo $pharInfoB;
28-
private readonly DifferFactory $differFactory;
26+
private PharInfo $pharInfoA;
27+
private PharInfo $pharInfoB;
28+
private DifferFactory $differFactory;
2929

3030
public function __construct(string $pathA, string $pathB)
3131
{

src/PhpScoper/ExcludedFilesScoper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
use function array_key_exists;
2020
use function func_get_args;
2121

22-
final class ExcludedFilesScoper implements PhpScoperScoper
22+
final readonly class ExcludedFilesScoper implements PhpScoperScoper
2323
{
24-
private readonly array $excludedFilePathsAsKeys;
24+
private array $excludedFilePathsAsKeys;
2525

2626
public function __construct(
27-
private readonly PhpScoperScoper $decoratedScoper,
27+
private PhpScoperScoper $decoratedScoper,
2828
string ...$excludedFilePaths,
2929
) {
3030
$this->excludedFilePathsAsKeys = array_flip($excludedFilePaths);

tests/Console/ApplicationTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,20 @@ public function test_get_helper_menu(): void
9797

9898
$quietSilentSegment = self::isSymfonyConsole72OrHigher()
9999
? <<<'EOF'
100-
--silent Do not output any message
101-
-q, --quiet Only errors are displayed. All other output is suppressed
102-
EOF
100+
--silent Do not output any message
101+
-q, --quiet Only errors are displayed. All other output is suppressed
102+
EOF
103103
: <<<'EOF'
104-
-q, --quiet Do not output any message
105-
EOF;
104+
-q, --quiet Do not output any message
105+
EOF;
106106

107107
$expected = <<<EOF
108108
109109
____
110110
/ __ )____ _ __
111-
/ __ / __ \| |/_/
111+
/ __ / __ \\| |/_/
112112
/ /_/ / /_/ /> <
113-
/_____/\____/_/|_|
113+
/_____/\\____/_/|_|
114114
115115
116116
Box version x.x-dev@151e40a
@@ -120,7 +120,7 @@ public function test_get_helper_menu(): void
120120
121121
Options:
122122
-h, --help Display help for the given command. When no command is given display help for the list command
123-
$quietSilentSegment
123+
{$quietSilentSegment}
124124
-V, --version Display this application version
125125
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
126126
-n, --no-interaction Do not ask any interactive question

0 commit comments

Comments
 (0)