Minor code improvements

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

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

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

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

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

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

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

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

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

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

@ -57,7 +57,7 @@ class GitLabTest extends TestCase
$this->equalTo($url = sprintf('http://%s/oauth/token', $this->origin)), $this->equalTo($url = sprintf('http://%s/oauth/token', $this->origin)),
$this->anything() $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(); $config = $this->getConfigMock();

Loading…
Cancel
Save