Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make implicit nullable types explicit #1019

Merged
merged 1 commit into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Cache.php
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
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
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
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
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
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
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
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
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
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