Skip to content

Commit

Permalink
minor #1019 Make implicit nullable types explicit (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Make implicit nullable types explicit

Commits
-------

1854c96 Make implicit nullable types explicit
  • Loading branch information
fabpot committed Mar 19, 2024
2 parents 06b58a5 + 1854c96 commit f3ffc83
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Cache extends BaseCache
private $downloader;
private $io;

public function setSymfonyRequire(string $symfonyRequire, RootPackageInterface $rootPackage, Downloader $downloader, IOInterface $io = null)
public function setSymfonyRequire(string $symfonyRequire, RootPackageInterface $rootPackage, Downloader $downloader, ?IOInterface $io = null)
{
$this->versionParser = new VersionParser();
$this->symfonyRequire = $symfonyRequire;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/UpdateRecipesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 0;
}

private function getRecipe(PackageInterface $package, string $recipeRef = null, string $recipeVersion = null): ?Recipe
private function getRecipe(PackageInterface $package, ?string $recipeRef = null, ?string $recipeVersion = null): ?Recipe
{
$operation = new InformationOperation($package);
if (null !== $recipeRef) {
Expand Down
2 changes: 1 addition & 1 deletion src/Configurator/EnvConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private function unconfigurePhpUnit(Recipe $recipe, $vars)
* If $originalValue is passed, and the value contains an expression.
* the $originalValue is used.
*/
private function evaluateValue($value, string $originalValue = null)
private function evaluateValue($value, ?string $originalValue = null)
{
if ('%generate(secret)%' === $value) {
if (null !== $originalValue) {
Expand Down
2 changes: 1 addition & 1 deletion src/Downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function getSessionId(): string
return $this->sess;
}

public function setFlexId(string $id = null)
public function setFlexId(?string $id = null)
{
// No-op to support downgrading to v1.12.x
}
Expand Down
4 changes: 2 additions & 2 deletions src/Flex.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ function ($value) {
$this->finish($rootDir, $originalComposerJsonHash);
}

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

private function shouldRecordOperation(OperationInterface $operation, bool $isDevMode, Composer $composer = null): bool
private function shouldRecordOperation(OperationInterface $operation, bool $isDevMode, ?Composer $composer = null): bool
{
if ($this->dryRun || $this->reinstall) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Options
private $writtenFiles = [];
private $io;

public function __construct(array $options = [], IOInterface $io = null)
public function __construct(array $options = [], ?IOInterface $io = null)
{
$this->options = $options;
$this->io = $io;
Expand Down
2 changes: 1 addition & 1 deletion src/ParallelDownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function callbackGet($notificationCode, $severity, $message, $messageCode
/**
* {@inheritdoc}
*/
protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null, $maxFileSize = null)
protected function getRemoteContents($originUrl, $fileUrl, $context, ?array &$responseHeaders = null, $maxFileSize = null)
{
if (isset(self::$cache[$fileUrl])) {
self::$cacheNext = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ScriptExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ScriptExecutor
private $options;
private $executor;

public function __construct(Composer $composer, IOInterface $io, Options $options, ProcessExecutor $executor = null)
public function __construct(Composer $composer, IOInterface $io, Options $options, ?ProcessExecutor $executor = null)
{
$this->composer = $composer;
$this->io = $io;
Expand Down
2 changes: 1 addition & 1 deletion src/TruncatedComposerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class TruncatedComposerRepository extends BaseComposerRepository
{
public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
public function __construct(array $repoConfig, IOInterface $io, Config $config, ?EventDispatcher $eventDispatcher = null, ?RemoteFilesystem $rfs = null)
{
parent::__construct($repoConfig, $io, $config, $eventDispatcher, $rfs);

Expand Down
2 changes: 1 addition & 1 deletion src/Unpacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(Composer $composer, PackageResolver $resolver, bool
$this->versionParser = new VersionParser();
}

public function unpack(Operation $op, Result $result = null, &$links = [], bool $devRequire = false): Result
public function unpack(Operation $op, ?Result $result = null, &$links = [], bool $devRequire = false): Result
{
if (null === $result) {
$result = new Result();
Expand Down

0 comments on commit f3ffc83

Please sign in to comment.