Minor code improvements

main
Simon Berger 4 years ago
parent 7053b6f761
commit 80a75e9959

@ -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;

@ -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;
}

@ -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;

@ -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;

@ -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;
}
/**

@ -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()

@ -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";
}
}

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

@ -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();

@ -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();

Loading…
Cancel
Save