1
0
Fork 0

Minor code improvements

pull/9204/head
Simon Berger 2020-09-11 23:13:42 +02:00
parent 7053b6f761
commit 80a75e9959
10 changed files with 13 additions and 22 deletions

View File

@ -729,8 +729,7 @@ EOT
private function checkConnectivity()
{
if (!ini_get('allow_url_fopen')) {
$result = '<info>Skipped because allow_url_fopen is missing.</info>';
return $result;
return '<info>Skipped because allow_url_fopen is missing.</info>';
}
return true;

View File

@ -453,13 +453,11 @@ TAGSPUBKEY
protected function getOldInstallationFinder($rollbackDir)
{
$finder = Finder::create()
return Finder::create()
->depth(0)
->files()
->name('*' . self::OLD_INSTALL_EXT)
->in($rollbackDir);
return $finder;
}
/**
@ -562,7 +560,7 @@ EOT;
$io->writeError('<info>Operation succeeded.</info>');
} else {
$io->writeError('<error>Operation failed (file not written). '.$helpMessage.'</error>');
};
}
return $result;
}

View File

@ -338,7 +338,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
$this->io->writeError(" - " . UpdateOperation::format($initial, $target) . ": ", false);
$promise = $this->remove($initial, $path, false);
if (!$promise instanceof PromiseInterface) {
if ($promise === null || !$promise instanceof PromiseInterface) {
$promise = \React\Promise\resolve();
}
$self = $this;

View File

@ -35,7 +35,7 @@ class HhvmDetector
public function getVersion()
{
if (null !== self::$hhvmVersion) {
return self::$hhvmVersion ?: null;
return self::$hhvmVersion;
}
self::$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;

View File

@ -116,14 +116,12 @@ class PerforceDriver extends VcsDriver
*/
public function getSource($identifier)
{
$source = array(
return array(
'type' => 'perforce',
'url' => $this->repoConfig['url'],
'reference' => $identifier,
'p4user' => $this->perforce->getUser(),
);
return $source;
}
/**

View File

@ -426,9 +426,7 @@ class Perforce
{
$index = strpos($identifier, '@');
if ($index === false) {
$path = $identifier. '/' . $file;
return $path;
return $identifier. '/' . $file;
}
$path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
@ -475,9 +473,7 @@ class Perforce
$lastCommitArr = explode(' ', $lastCommit);
$lastCommitNum = $lastCommitArr[1];
$branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
return $branches;
return array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
}
public function getTags()

View File

@ -3,14 +3,14 @@
namespace Foo;
class SlashedA {
function foo() {
public function foo() {
return sprintf("foo\
bar");
}
}
class SlashedB {
function bar() {
public function bar() {
print "baz";
}
}

View File

@ -324,7 +324,7 @@ class BitbucketTest extends TestCase
$this->token
)
)
);
)
;
$this->setExpectationsForStoringAccessToken(true);

View File

@ -51,7 +51,7 @@ class GitHubTest extends TestCase
$this->equalTo($url = sprintf('https://api.%s/', $this->origin)),
$this->anything()
)
->willReturn(new Response(array('url' => $url), 200, array(), '{}'));
->willReturn(new Response(array('url' => $url), 200, array(), '{}'))
;
$config = $this->getConfigMock();

View File

@ -57,7 +57,7 @@ class GitLabTest extends TestCase
$this->equalTo($url = sprintf('http://%s/oauth/token', $this->origin)),
$this->anything()
)
->willReturn(new Response(array('url' => $url), 200, array(), sprintf('{"access_token": "%s", "token_type": "bearer", "expires_in": 7200}', $this->token)));
->willReturn(new Response(array('url' => $url), 200, array(), sprintf('{"access_token": "%s", "token_type": "bearer", "expires_in": 7200}', $this->token)))
;
$config = $this->getConfigMock();