diff --git a/src/Cache.php b/src/Cache.php index 6ecca1590..f861e4d96 100644 --- a/src/Cache.php +++ b/src/Cache.php @@ -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; diff --git a/src/Command/UpdateRecipesCommand.php b/src/Command/UpdateRecipesCommand.php index c75507eca..15296efc1 100644 --- a/src/Command/UpdateRecipesCommand.php +++ b/src/Command/UpdateRecipesCommand.php @@ -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) { diff --git a/src/Configurator/EnvConfigurator.php b/src/Configurator/EnvConfigurator.php index 9fd81bd30..97c62d6f0 100644 --- a/src/Configurator/EnvConfigurator.php +++ b/src/Configurator/EnvConfigurator.php @@ -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) { diff --git a/src/Downloader.php b/src/Downloader.php index d03f6b8b4..fe8aa90e7 100644 --- a/src/Downloader.php +++ b/src/Downloader.php @@ -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 } diff --git a/src/Flex.php b/src/Flex.php index a305d386f..a45ce90df 100644 --- a/src/Flex.php +++ b/src/Flex.php @@ -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(); @@ -934,7 +934,7 @@ private function formatOrigin(Recipe $recipe): string return sprintf('%s (>=%s): From %s', $matches[1], $matches[2], 'auto-generated recipe' === $matches[3] ? ''.$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; diff --git a/src/Options.php b/src/Options.php index f0872b510..3e41f2296 100644 --- a/src/Options.php +++ b/src/Options.php @@ -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; diff --git a/src/ParallelDownloader.php b/src/ParallelDownloader.php index 5452df6c3..bfa95d305 100644 --- a/src/ParallelDownloader.php +++ b/src/ParallelDownloader.php @@ -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; diff --git a/src/ScriptExecutor.php b/src/ScriptExecutor.php index d61694735..9aa3327f5 100644 --- a/src/ScriptExecutor.php +++ b/src/ScriptExecutor.php @@ -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; diff --git a/src/TruncatedComposerRepository.php b/src/TruncatedComposerRepository.php index 82485aeaf..ddf77eb87 100644 --- a/src/TruncatedComposerRepository.php +++ b/src/TruncatedComposerRepository.php @@ -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); diff --git a/src/Unpacker.php b/src/Unpacker.php index 97482929a..ddc0cb189 100644 --- a/src/Unpacker.php +++ b/src/Unpacker.php @@ -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();