1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 16:42:57 +00:00

Add parameter types to all the things

This commit is contained in:
Jordi Boggiano 2022-02-22 16:47:09 +01:00
parent c9baeda95b
commit 6da38f83a0
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
279 changed files with 1377 additions and 1504 deletions

View file

@ -74,7 +74,7 @@ class Application extends BaseApplication
private $disableScriptsByDefault = false;
/**
* @var string Store the initial working directory at startup time
* @var string|false Store the initial working directory at startup time
*/
private $initialWorkingDirectory;
@ -151,10 +151,11 @@ class Application extends BaseApplication
// switch working dir
if ($newWorkDir = $this->getNewWorkingDir($input)) {
$oldWorkingDir = getcwd();
$oldWorkingDir = Platform::getCwd(true);
chdir($newWorkDir);
$this->initialWorkingDirectory = $newWorkDir;
$io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
$cwd = Platform::getCwd(true);
$io->writeError('Changed CWD to ' . ($cwd !== '' ? $cwd : $newWorkDir), true, IOInterface::DEBUG);
}
// determine command name to be executed without including plugin commands
@ -171,7 +172,7 @@ class Application extends BaseApplication
// prompt user for dir change if no composer.json is present in current dir
if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) {
$dir = dirname(getcwd());
$dir = dirname(Platform::getCwd(true));
$home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
// abort when we reach the home dir or top of the filesystem
@ -183,7 +184,7 @@ class Application extends BaseApplication
} else {
$io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
}
$oldWorkingDir = getcwd();
$oldWorkingDir = Platform::getCwd(true);
chdir($dir);
}
break;
@ -330,7 +331,7 @@ class Application extends BaseApplication
$result = parent::doRun($input, $output);
// chdir back to $oldWorkingDir if set
if (isset($oldWorkingDir)) {
if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
Silencer::call('chdir', $oldWorkingDir);
}
@ -424,7 +425,7 @@ class Application extends BaseApplication
* @throws \InvalidArgumentException
* @return ?\Composer\Composer If $required is true then the return value is guaranteed
*/
public function getComposer($required = true, $disablePlugins = null, $disableScripts = null)
public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null)
{
if (null === $disablePlugins) {
$disablePlugins = $this->disablePluginsByDefault;
@ -585,7 +586,7 @@ class Application extends BaseApplication
/**
* Get the working directory at startup time
*
* @return string
* @return string|false
*/
public function getInitialWorkingDirectory()
{