Skip to content

Commit 96f355d

Browse files
Merge branch '1.x' into 2.x
* 1.x: More explicit nullable types Make implicit nullable types explicit
2 parents b0a405f + 2081076 commit 96f355d

File tree

10 files changed

+17
-12
lines changed

10 files changed

+17
-12
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'array_syntax' => ['syntax' => 'short'],
1313
'ordered_imports' => true,
1414
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
15+
'nullable_type_declaration_for_default_null_value' => true,
1516
'protected_to_private' => false,
1617
))
1718
->setRiskyAllowed(true)

src/Command/UpdateRecipesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
262262
return 0;
263263
}
264264

265-
private function getRecipe(PackageInterface $package, string $recipeRef = null, string $recipeVersion = null): ?Recipe
265+
private function getRecipe(PackageInterface $package, ?string $recipeRef = null, ?string $recipeVersion = null): ?Recipe
266266
{
267267
$operation = new InformationOperation($package);
268268
if (null !== $recipeRef) {

src/Configurator/EnvConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private function unconfigurePhpUnit(Recipe $recipe, $vars)
177177
* If $originalValue is passed, and the value contains an expression.
178178
* the $originalValue is used.
179179
*/
180-
private function evaluateValue($value, string $originalValue = null)
180+
private function evaluateValue($value, ?string $originalValue = null)
181181
{
182182
if ('%generate(secret)%' === $value) {
183183
if (null !== $originalValue) {

src/Downloader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ class Downloader
5151
private $enabled = true;
5252
private $composer;
5353

54+
<<<<<<< HEAD
5455
public function __construct(Composer $composer, IoInterface $io, HttpDownloader $rfs)
56+
=======
57+
public function __construct(Composer $composer, IOInterface $io, $rfs)
58+
>>>>>>> 1.x
5559
{
5660
if (getenv('SYMFONY_CAFILE')) {
5761
$this->caFile = getenv('SYMFONY_CAFILE');

src/Flex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ function ($value) {
486486
$this->finish($rootDir, $originalComposerJsonHash);
487487
}
488488

489-
public function finish(string $rootDir, string $originalComposerJsonHash = null): void
489+
public function finish(string $rootDir, ?string $originalComposerJsonHash = null): void
490490
{
491491
$this->synchronizePackageJson($rootDir);
492492
$this->lock->write();
@@ -718,7 +718,7 @@ private function formatOrigin(Recipe $recipe): string
718718
return sprintf('<info>%s</> (<comment>>=%s</>): From %s', $matches[1], $matches[2], 'auto-generated recipe' === $matches[3] ? '<comment>'.$matches[3].'</>' : $matches[3]);
719719
}
720720

721-
private function shouldRecordOperation(OperationInterface $operation, bool $isDevMode, Composer $composer = null): bool
721+
private function shouldRecordOperation(OperationInterface $operation, bool $isDevMode, ?Composer $composer = null): bool
722722
{
723723
if ($this->dryRun || $this->reinstall) {
724724
return false;

src/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Options
2323
private $writtenFiles = [];
2424
private $io;
2525

26-
public function __construct(array $options = [], IOInterface $io = null)
26+
public function __construct(array $options = [], ?IOInterface $io = null)
2727
{
2828
$this->options = $options;
2929
$this->io = $io;

src/ScriptExecutor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ScriptExecutor
3030
private $options;
3131
private $executor;
3232

33-
public function __construct(Composer $composer, IOInterface $io, Options $options, ProcessExecutor $executor = null)
33+
public function __construct(Composer $composer, IOInterface $io, Options $options, ?ProcessExecutor $executor = null)
3434
{
3535
$this->composer = $composer;
3636
$this->io = $io;

src/Unpacker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(Composer $composer, PackageResolver $resolver, bool
4040
$this->versionParser = new VersionParser();
4141
}
4242

43-
public function unpack(Operation $op, Result $result = null, &$links = [], bool $devRequire = false): Result
43+
public function unpack(Operation $op, ?Result $result = null, &$links = [], bool $devRequire = false): Result
4444
{
4545
if (null === $result) {
4646
$result = new Result();

tests/Configurator/AddLinesConfiguratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public function getUpdateTests()
568568
];
569569
}
570570

571-
private function runConfigure(array $config, Composer $composer = null)
571+
private function runConfigure(array $config, ?Composer $composer = null)
572572
{
573573
$configurator = $this->createConfigurator($composer);
574574

@@ -586,7 +586,7 @@ private function runUnconfigure(array $config)
586586
$configurator->unconfigure($recipe, $config, $lock);
587587
}
588588

589-
private function createConfigurator(Composer $composer = null)
589+
private function createConfigurator(?Composer $composer = null)
590590
{
591591
return new AddLinesConfigurator(
592592
$composer ?: $this->getMockBuilder(Composer::class)->getMock(),

tests/FlexTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ private function mockPackageEvent(Package $package): PackageEvent
375375
return $event;
376376
}
377377

378-
private function mockConfigurator(Recipe $recipe = null): Configurator
378+
private function mockConfigurator(?Recipe $recipe = null): Configurator
379379
{
380380
$configurator = $this->getMockBuilder(Configurator::class)->disableOriginalConstructor()->getMock();
381381

@@ -406,7 +406,7 @@ private function mockLocker(array $lockData = []): Locker
406406
return $locker;
407407
}
408408

409-
private function mockComposer(Locker $locker, RootPackageInterface $package, Config $config = null): Composer
409+
private function mockComposer(Locker $locker, RootPackageInterface $package, ?Config $config = null): Composer
410410
{
411411
if (null === $config) {
412412
$config = $this->getMockBuilder(Config::class)->getMock();
@@ -474,7 +474,7 @@ private function mockFlexCustom(BufferIO $io, Composer $composer, Configurator $
474474
}, null, Flex::class)->__invoke();
475475
}
476476

477-
private function mockFlex(BufferIO $io, RootPackageInterface $package, Recipe $recipe = null, array $recipes = [], array $lockerData = []): Flex
477+
private function mockFlex(BufferIO $io, RootPackageInterface $package, ?Recipe $recipe = null, array $recipes = [], array $lockerData = []): Flex
478478
{
479479
$composer = $this->mockComposer($this->mockLocker($lockerData), $package);
480480

0 commit comments

Comments
 (0)