diff --git a/scripts/arcanist.php b/scripts/arcanist.php --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -195,8 +195,8 @@ if ($need_working_copy || $want_working_copy) { if ($need_working_copy && !$working_copy->getVCSType()) { throw new ArcanistUsageException( - "This command must be run in a Git, Mercurial or Subversion working ". - "copy."); + 'This command must be run in a Git, Mercurial or Subversion working '. + 'copy.'); } $configuration_manager->setWorkingCopyIdentity($working_copy); } @@ -352,7 +352,7 @@ echo phutil_console_format( "**Exception**\n%s\n%s\n", $ex->getMessage(), - "(Run with --trace for a full exception trace.)"); + '(Run with --trace for a full exception trace.)'); } exit(1); diff --git a/scripts/hgdaemon/hgdaemon_client.php b/scripts/hgdaemon/hgdaemon_client.php --- a/scripts/hgdaemon/hgdaemon_client.php +++ b/scripts/hgdaemon/hgdaemon_client.php @@ -22,7 +22,7 @@ $repo = $args->getArg('repository'); if (count($repo) !== 1) { - throw new Exception("Specify exactly one working copy!"); + throw new Exception('Specify exactly one working copy!'); } $repo = head($repo); diff --git a/scripts/hgdaemon/hgdaemon_server.php b/scripts/hgdaemon/hgdaemon_server.php --- a/scripts/hgdaemon/hgdaemon_server.php +++ b/scripts/hgdaemon/hgdaemon_server.php @@ -40,7 +40,7 @@ $repo = $args->getArg('repository'); if (count($repo) !== 1) { - throw new Exception("Specify exactly one working copy!"); + throw new Exception('Specify exactly one working copy!'); } $repo = head($repo); diff --git a/scripts/lib/PhutilLibraryMapBuilder.php b/scripts/lib/PhutilLibraryMapBuilder.php --- a/scripts/lib/PhutilLibraryMapBuilder.php +++ b/scripts/lib/PhutilLibraryMapBuilder.php @@ -152,7 +152,7 @@ $result['error']); exit(1); } - $this->log("."); + $this->log('.'); } $this->log("\nDone.\n"); } diff --git a/scripts/phutil_rebuild_map.php b/scripts/phutil_rebuild_map.php --- a/scripts/phutil_rebuild_map.php +++ b/scripts/phutil_rebuild_map.php @@ -49,7 +49,7 @@ $root = $args->getArg('root'); if (count($root) !== 1) { - throw new Exception("Provide exactly one library root!"); + throw new Exception('Provide exactly one library root!'); } $root = Filesystem::resolvePath(head($root)); diff --git a/scripts/phutil_symbols.php b/scripts/phutil_symbols.php --- a/scripts/phutil_symbols.php +++ b/scripts/phutil_symbols.php @@ -52,7 +52,7 @@ $paths = $args->getArg('path'); if (count($paths) !== 1) { - throw new Exception("Specify exactly one path!"); + throw new Exception('Specify exactly one path!'); } $path = Filesystem::resolvePath(head($paths)); diff --git a/src/configuration/ArcanistConfiguration.php b/src/configuration/ArcanistConfiguration.php --- a/src/configuration/ArcanistConfiguration.php +++ b/src/configuration/ArcanistConfiguration.php @@ -168,7 +168,7 @@ private function raiseUnknownCommand($command, array $maybe = array()) { $message = pht("Unknown command '%s'. Try 'arc help'.", $command); if ($maybe) { - $message .= "\n\n".pht("Did you mean:")."\n"; + $message .= "\n\n".pht('Did you mean:')."\n"; sort($maybe); foreach ($maybe as $other) { $message .= " ".$other."\n"; diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php --- a/src/configuration/ArcanistConfigurationManager.php +++ b/src/configuration/ArcanistConfigurationManager.php @@ -151,7 +151,7 @@ return $this->workingCopy->writeLocalArcConfig($config); } - throw new Exception(pht("No working copy to write config to!")); + throw new Exception(pht('No working copy to write config to!')); } /** @@ -235,7 +235,7 @@ public function setUserConfigurationFileLocation($custom_arcrc) { if (!Filesystem::pathExists($custom_arcrc)) { throw new Exception( - "Custom arcrc file was specified, but it was not found!"); + 'Custom arcrc file was specified, but it was not found!'); } $this->customArcrcFilename = $custom_arcrc; diff --git a/src/configuration/ArcanistSettings.php b/src/configuration/ArcanistSettings.php --- a/src/configuration/ArcanistSettings.php +++ b/src/configuration/ArcanistSettings.php @@ -142,7 +142,7 @@ 'browser' => array( 'type' => 'string', 'help' => - "Command to use to invoke a web browser.", + 'Command to use to invoke a web browser.', 'example' => '"gnome-www-browser"', ), 'events.listeners' => array( @@ -154,13 +154,13 @@ 'http.basicauth.user' => array( 'type' => 'string', 'help' => - "Username to use for basic auth over http transports", + 'Username to use for basic auth over http transports', 'example' => '"bob"', ), 'http.basicauth.pass' => array( 'type' => 'string', 'help' => - "Password to use for basic auth over http transports", + 'Password to use for basic auth over http transports', 'example' => '"bobhasasecret"', ), 'arc.autostash' => array( diff --git a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php --- a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php +++ b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php @@ -100,7 +100,7 @@ $utf8_tests = array( array( - "GrumpyCat", + 'GrumpyCat', "Grumpy\xE2\x98\x83at", 'ssssssxss', ), @@ -118,8 +118,8 @@ public function testGenerateUTF8IntralineDiff() { // Both Strings Empty. - $left = ""; - $right = ""; + $left = ''; + $right = ''; $result = array( array(array(0, 0)), array(array(0, 0)) @@ -129,7 +129,7 @@ ArcanistDiffUtils::generateIntralineDiff($left, $right)); // Left String Empty. - $left = ""; + $left = ''; $right = "Grumpy\xE2\x98\x83at"; $result = array( array(array(0, 0)), @@ -141,7 +141,7 @@ // Right String Empty. $left = "Grumpy\xE2\x98\x83at"; - $right = ""; + $right = ''; $result = array( array(array(0, 11)), array(array(0, 0)) @@ -163,7 +163,7 @@ // Both Strings are different. $left = "Grumpy\xE2\x98\x83at"; - $right = "Smiling Dog"; + $right = 'Smiling Dog'; $result = array( array(array(1, 11)), array(array(1, 11)) @@ -173,7 +173,7 @@ ArcanistDiffUtils::generateIntralineDiff($left, $right)); // String with one difference in the middle. - $left = "GrumpyCat"; + $left = 'GrumpyCat'; $right = "Grumpy\xE2\x98\x83at"; $result = array( array(array(0, 6), array(1, 1), array(0, 2)), @@ -184,7 +184,7 @@ ArcanistDiffUtils::generateIntralineDiff($left, $right)); // Differences in middle, not connected to each other. - $left = "GrumpyCat"; + $left = 'GrumpyCat'; $right = "Grumpy\xE2\x98\x83a\xE2\x98\x83t"; $result = array( array(array(0, 6), array(1, 2), array(0, 1)), @@ -229,7 +229,7 @@ // This is a unicode combining character, "COMBINING DOUBLE TILDE". $cc = "\xCD\xA0"; - $left = "Senor"; + $left = 'Senor'; $right = "Sen{$cc}or"; $result = array( array(array(0, 2), array(1, 1), array(0, 2)), diff --git a/src/hgdaemon/ArcanistHgClientChannel.php b/src/hgdaemon/ArcanistHgClientChannel.php --- a/src/hgdaemon/ArcanistHgClientChannel.php +++ b/src/hgdaemon/ArcanistHgClientChannel.php @@ -57,7 +57,7 @@ */ protected function encodeMessage($argv) { if (!is_array($argv) || count($argv) !== 2) { - throw new Exception("Message should be ."); + throw new Exception('Message should be .'); } $channel = head($argv); diff --git a/src/hgdaemon/ArcanistHgProxyServer.php b/src/hgdaemon/ArcanistHgProxyServer.php --- a/src/hgdaemon/ArcanistHgProxyServer.php +++ b/src/hgdaemon/ArcanistHgProxyServer.php @@ -181,7 +181,7 @@ )); if (!$hg->update()) { - throw new Exception("Server exited unexpectedly!"); + throw new Exception('Server exited unexpectedly!'); } // Accept any new clients. @@ -353,7 +353,7 @@ $ok = stream_set_blocking($socket, 0); if ($ok === false) { - throw new Exception("Unable to set socket nonblocking!"); + throw new Exception('Unable to set socket nonblocking!'); } return $socket; @@ -461,7 +461,7 @@ $pid = pcntl_fork(); if ($pid === -1) { - throw new Exception("Unable to fork!"); + throw new Exception('Unable to fork!'); } else if ($pid) { // We're the parent; exit. First, drop our reference to the socket so // our __destruct() doesn't tear it down; the child will tear it down diff --git a/src/hgdaemon/ArcanistHgServerChannel.php b/src/hgdaemon/ArcanistHgServerChannel.php --- a/src/hgdaemon/ArcanistHgServerChannel.php +++ b/src/hgdaemon/ArcanistHgServerChannel.php @@ -86,7 +86,7 @@ */ protected function encodeMessage($argv) { if (!is_array($argv)) { - throw new Exception("Message to Mercurial server should be an array."); + throw new Exception('Message to Mercurial server should be an array.'); } $command = head($argv); diff --git a/src/lint/ArcanistLintPatcher.php b/src/lint/ArcanistLintPatcher.php --- a/src/lint/ArcanistLintPatcher.php +++ b/src/lint/ArcanistLintPatcher.php @@ -48,7 +48,7 @@ } Filesystem::writeFile($lint, $data); - list($err) = exec_manual("mv -f %s %s", $lint, $path); + list($err) = exec_manual('mv -f %s %s', $lint, $path); if ($err) { throw new Exception( "Unable to overwrite path `{$path}', patched version was left ". diff --git a/src/lint/engine/ArcanistLintEngine.php b/src/lint/engine/ArcanistLintEngine.php --- a/src/lint/engine/ArcanistLintEngine.php +++ b/src/lint/engine/ArcanistLintEngine.php @@ -208,7 +208,7 @@ final public function run() { $linters = $this->buildLinters(); if (!$linters) { - throw new ArcanistNoEffectException("No linters to run."); + throw new ArcanistNoEffectException('No linters to run.'); } $linters = msort($linters, 'getLinterPriority'); @@ -225,7 +225,7 @@ } if (!$have_paths) { - throw new ArcanistNoEffectException("No paths are lintable."); + throw new ArcanistNoEffectException('No paths are lintable.'); } $versions = array($this->getCacheVersion()); diff --git a/src/lint/linter/ArcanistCSharpLinter.php b/src/lint/linter/ArcanistCSharpLinter.php --- a/src/lint/linter/ArcanistCSharpLinter.php +++ b/src/lint/linter/ArcanistCSharpLinter.php @@ -60,7 +60,7 @@ public function setCustomSeverityMap(array $map) { foreach ($map as $code => $severity) { - if (substr($code, 0, 2) === "SA" && $severity == "disabled") { + if (substr($code, 0, 2) === 'SA' && $severity == 'disabled') { throw new Exception( "In order to keep StyleCop integration with IDEs and other tools ". "consistent with Arcanist results, you aren't permitted to ". @@ -88,42 +88,42 @@ // Determine runtime engine (.NET or Mono). if (phutil_is_windows()) { - $this->runtimeEngine = ""; - } else if (Filesystem::binaryExists("mono")) { - $this->runtimeEngine = "mono "; + $this->runtimeEngine = ''; + } else if (Filesystem::binaryExists('mono')) { + $this->runtimeEngine = 'mono '; } else { - throw new Exception("Unable to find Mono and you are not on Windows!"); + throw new Exception('Unable to find Mono and you are not on Windows!'); } // Determine cslint path. $cslint = $this->cslintHintPath; if ($cslint !== null && file_exists($cslint)) { $this->cslintEngine = Filesystem::resolvePath($cslint); - } else if (Filesystem::binaryExists("cslint.exe")) { - $this->cslintEngine = "cslint.exe"; + } else if (Filesystem::binaryExists('cslint.exe')) { + $this->cslintEngine = 'cslint.exe'; } else { - throw new Exception("Unable to locate cslint."); + throw new Exception('Unable to locate cslint.'); } // Determine cslint version. $ver_future = new ExecFuture( - "%C -v", + '%C -v', $this->runtimeEngine.$this->cslintEngine); list($err, $stdout, $stderr) = $ver_future->resolve(); if ($err !== 0) { throw new Exception( - "You are running an old version of cslint. Please ". - "upgrade to version ".self::SUPPORTED_VERSION."."); + 'You are running an old version of cslint. Please '. + 'upgrade to version '.self::SUPPORTED_VERSION.'.'); } $ver = (int)$stdout; if ($ver < self::SUPPORTED_VERSION) { throw new Exception( - "You are running an old version of cslint. Please ". - "upgrade to version ".self::SUPPORTED_VERSION."."); - } elseif ($ver > self::SUPPORTED_VERSION) { + 'You are running an old version of cslint. Please '. + 'upgrade to version '.self::SUPPORTED_VERSION.'.'); + } else if ($ver > self::SUPPORTED_VERSION) { throw new Exception( - "Arcanist does not support this version of cslint (it is ". - "newer). You can try upgrading Arcanist with `arc upgrade`."); + 'Arcanist does not support this version of cslint (it is '. + 'newer). You can try upgrading Arcanist with `arc upgrade`.'); } $this->loaded = true; @@ -158,7 +158,7 @@ // settings JSON through base64-encoded to mitigate // this issue. $futures[] = new ExecFuture( - "%C --settings-base64=%s -r=. %Ls", + '%C --settings-base64=%s -r=. %Ls', $this->runtimeEngine.$this->cslintEngine, base64_encode(json_encode($this->discoveryMap)), $current_paths); @@ -173,7 +173,7 @@ // a future for those too. if (count($current_paths) > 0) { $futures[] = new ExecFuture( - "%C --settings-base64=%s -r=. %Ls", + '%C --settings-base64=%s -r=. %Ls', $this->runtimeEngine.$this->cslintEngine, base64_encode(json_encode($this->discoveryMap)), $current_paths); diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php --- a/src/lint/linter/ArcanistExternalLinter.php +++ b/src/lint/linter/ArcanistExternalLinter.php @@ -204,7 +204,7 @@ * @task bin */ public function getDefaultInterpreter() { - throw new Exception("Incomplete implementation!"); + throw new Exception('Incomplete implementation!'); } diff --git a/src/lint/linter/ArcanistFlake8Linter.php b/src/lint/linter/ArcanistFlake8Linter.php --- a/src/lint/linter/ArcanistFlake8Linter.php +++ b/src/lint/linter/ArcanistFlake8Linter.php @@ -128,10 +128,10 @@ 'Unrecognized lint message code "%s". Expected a valid flake8 '. 'lint code like "%s", or "%s", or "%s", or "%s".', $code, - "E225", - "W291", - "F811", - "C901")); + 'E225', + 'W291', + 'F811', + 'C901')); } return $code; diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php --- a/src/lint/linter/ArcanistLinter.php +++ b/src/lint/linter/ArcanistLinter.php @@ -221,7 +221,7 @@ if (isset($map[$code])) { return $map[$code]; } - return "Unknown lint message!"; + return 'Unknown lint message!'; } final protected function addLintMessage(ArcanistLintMessage $message) { diff --git a/src/lint/linter/ArcanistPEP8Linter.php b/src/lint/linter/ArcanistPEP8Linter.php --- a/src/lint/linter/ArcanistPEP8Linter.php +++ b/src/lint/linter/ArcanistPEP8Linter.php @@ -125,8 +125,8 @@ 'Unrecognized lint message code "%s". Expected a valid PEP8 '. 'lint code like "%s" or "%s".', $code, - "E101", - "W291")); + 'E101', + 'W291')); } return $code; diff --git a/src/lint/linter/ArcanistPyLintLinter.php b/src/lint/linter/ArcanistPyLintLinter.php --- a/src/lint/linter/ArcanistPyLintLinter.php +++ b/src/lint/linter/ArcanistPyLintLinter.php @@ -98,13 +98,13 @@ } private function getPyLintPath() { - $pylint_bin = "pylint"; + $pylint_bin = 'pylint'; // Use the PyLint prefix specified in the config file $config = $this->getEngine()->getConfigurationManager(); $prefix = $config->getConfigFromAnySource('lint.pylint.prefix'); if ($prefix !== null) { - $pylint_bin = $prefix."/bin/".$pylint_bin; + $pylint_bin = $prefix.'/bin/'.$pylint_bin; } if (!Filesystem::pathExists($pylint_bin)) { @@ -156,7 +156,7 @@ } $python_path[] = ''; - return implode(":", $python_path); + return implode(':', $python_path); } private function getPyLintOptions() { @@ -164,8 +164,8 @@ $options = array('-rn'); // Version 0.x.x include the pylint message ids in the output - if (version_compare($this->getLinterVersion(), "1", 'lt')) { - array_push($options, '-iy', "--output-format=text"); + if (version_compare($this->getLinterVersion(), '1', 'lt')) { + array_push($options, '-iy', '--output-format=text'); } // Version 1.x.x set the output specifically to the 0.x.x format else { @@ -192,7 +192,7 @@ $options = array_merge($options, $config_options); } - return implode(" ", $options); + return implode(' ', $options); } public function getLinterName() { @@ -216,7 +216,7 @@ // Assume a future version that at least is compatible with 1.x.x if (count($lines) == 0 || !preg_match('/pylint\s((?:\d+\.?)+)/', $lines[0], $matches)) { - return "999"; + return '999'; } return $matches[1]; @@ -264,7 +264,7 @@ $message->setPath($path); $message->setLine($matches[2]); $message->setCode($matches[1]); - $message->setName($this->getLinterName()." ".$matches[1]); + $message->setName($this->getLinterName().' '.$matches[1]); $message->setDescription($matches[3]); $message->setSeverity($this->getMessageCodeSeverity($matches[1])); $this->addLintMessage($message); diff --git a/src/lint/linter/ArcanistRubyLinter.php b/src/lint/linter/ArcanistRubyLinter.php --- a/src/lint/linter/ArcanistRubyLinter.php +++ b/src/lint/linter/ArcanistRubyLinter.php @@ -75,7 +75,7 @@ foreach ($lines as $line) { $matches = null; - if (!preg_match("/(.*?):(\d+): (.*?)$/", $line, $matches)) { + if (!preg_match('/(.*?):(\d+): (.*?)$/', $line, $matches)) { continue; } diff --git a/src/lint/linter/ArcanistTextLinter.php b/src/lint/linter/ArcanistTextLinter.php --- a/src/lint/linter/ArcanistTextLinter.php +++ b/src/lint/linter/ArcanistTextLinter.php @@ -170,7 +170,7 @@ $this->raiseLintAtOffset( strlen($data), self::LINT_EOF_NEWLINE, - "Files must end in a newline.", + 'Files must end in a newline.', '', "\n"); } diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -302,12 +302,12 @@ $this->raiseLintAtNode( $strstr, self::LINT_SLOWNESS, - "Use strpos() for checking if the string contains something."); + 'Use strpos() for checking if the string contains something.'); } else if ($name == 'stristr') { $this->raiseLintAtNode( $strstr, self::LINT_SLOWNESS, - "Use stripos() for checking if the string contains something."); + 'Use stripos() for checking if the string contains something.'); } } } @@ -344,13 +344,13 @@ $this->raiseLintAtNode( $strpos, self::LINT_SLOWNESS, - "Use strncmp() for checking if the string starts with something."); + 'Use strncmp() for checking if the string starts with something.'); } else if ($name == 'stripos') { $this->raiseLintAtNode( $strpos, self::LINT_SLOWNESS, - "Use strncasecmp() for checking if the string starts with ". - "something."); + 'Use strncasecmp() for checking if the string starts with '. + 'something.'); } } } @@ -480,7 +480,7 @@ self::LINT_PHP_53_FEATURES, "This codebase targets PHP 5.3.0 on Windows, but `{$name}()` is not ". "available there". - ($windows ? " until PHP {$windows}" : "")."."); + ($windows ? " until PHP {$windows}" : '')."."); } } @@ -510,9 +510,9 @@ $this->raiseLintAtNode( $index->getChildByIndex(1), self::LINT_PHP_54_FEATURES, - "The f()[...] syntax was not introduced until PHP 5.4, but this ". - "codebase targets an earlier version of PHP. You can rewrite ". - "this expression using idx()."); + 'The f()[...] syntax was not introduced until PHP 5.4, but this '. + 'codebase targets an earlier version of PHP. You can rewrite '. + 'this expression using idx().'); break; } } @@ -2044,7 +2044,7 @@ $this->raiseLintAtNode( $unary, self::LINT_EXIT_EXPRESSION, - "Use exit as a statement, not an expression."); + 'Use exit as a statement, not an expression.'); } } } @@ -2208,8 +2208,8 @@ $message = $this->raiseLintAtNode( $node, self::LINT_DUPLICATE_KEYS_IN_ARRAY, - "Duplicate key in array initializer. PHP will ignore all ". - "but the last entry."); + 'Duplicate key in array initializer. PHP will ignore all '. + 'but the last entry.'); $locations = array(); foreach ($nodes_by_key[$key] as $node) { diff --git a/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php b/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php --- a/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php @@ -5,7 +5,7 @@ public function testClosureLinter() { $linter = new ArcanistClosureLinter(); - $linter->setFlags(array("--additional_extensions=lint-test")); + $linter->setFlags(array('--additional_extensions=lint-test')); $this->executeTestsInDirectory( dirname(__FILE__).'/gjslint/', diff --git a/src/lint/renderer/ArcanistLintConsoleRenderer.php b/src/lint/renderer/ArcanistLintConsoleRenderer.php --- a/src/lint/renderer/ArcanistLintConsoleRenderer.php +++ b/src/lint/renderer/ArcanistLintConsoleRenderer.php @@ -43,7 +43,7 @@ foreach ($message->getOtherLocations() as $location) { $locations[] = idx($location, 'path', $path). - (!empty($location['line']) ? ":{$location['line']}" : ""); + (!empty($location['line']) ? ":{$location['line']}" : ''); } $description .= "\nOther locations: ".implode(', ', $locations); } @@ -226,7 +226,7 @@ protected function renderLine($line, $data, $chevron = false, $diff = null) { $chevron = $chevron ? '>>>' : ''; return sprintf( - " %3s %1s %6s %s", + ' %3s %1s %6s %s', $chevron, $diff, $line, diff --git a/src/lint/renderer/ArcanistLintJSONRenderer.php b/src/lint/renderer/ArcanistLintJSONRenderer.php --- a/src/lint/renderer/ArcanistLintJSONRenderer.php +++ b/src/lint/renderer/ArcanistLintJSONRenderer.php @@ -30,6 +30,6 @@ } public function renderOkayResult() { - return ""; + return ''; } } diff --git a/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php --- a/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php +++ b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php @@ -30,6 +30,6 @@ } public function renderOkayResult() { - return ""; + return ''; } } diff --git a/src/lint/renderer/ArcanistLintSummaryRenderer.php b/src/lint/renderer/ArcanistLintSummaryRenderer.php --- a/src/lint/renderer/ArcanistLintSummaryRenderer.php +++ b/src/lint/renderer/ArcanistLintSummaryRenderer.php @@ -20,7 +20,7 @@ $text[] = "{$path}:{$line}:{$severity}: {$name}\n"; } - return implode("", $text); + return implode('', $text); } public function renderOkayResult() { diff --git a/src/parser/ArcanistBaseCommitParser.php b/src/parser/ArcanistBaseCommitParser.php --- a/src/parser/ArcanistBaseCommitParser.php +++ b/src/parser/ArcanistBaseCommitParser.php @@ -121,10 +121,10 @@ switch ($name) { case 'verbose': $this->verbose = true; - $this->log("Enabled verbose mode."); + $this->log('Enabled verbose mode.'); break; case 'prompt': - $reason = "it is what you typed when prompted."; + $reason = 'it is what you typed when prompted.'; $this->api->setBaseCommitExplanation($reason); return phutil_console_prompt('Against which commit?'); case 'local': @@ -144,7 +144,7 @@ case 'halt': // Dump the whole stack. $this->try = array(); - $this->log("Halting all rule processing."); + $this->log('Halting all rule processing.'); return false; case 'skip': return null; diff --git a/src/parser/ArcanistBundle.php b/src/parser/ArcanistBundle.php --- a/src/parser/ArcanistBundle.php +++ b/src/parser/ArcanistBundle.php @@ -379,7 +379,7 @@ if (!$decompose_okay) { throw new Exception( - "Failed to decompose multicopy changeset in order to generate diff."); + 'Failed to decompose multicopy changeset in order to generate diff.'); } } @@ -763,7 +763,7 @@ $content = array(); $content[] = "index {$old_sha1}..{$new_sha1}".$eol; - $content[] = "GIT binary patch".$eol; + $content[] = 'GIT binary patch'.$eol; $content[] = "literal {$new_length}".$eol; $content[] = $this->emitBinaryDiffBody($new_data).$eol; @@ -779,9 +779,9 @@ if (!function_exists('gzcompress')) { throw new Exception( - "This patch has binary data. The PHP zlib extension is required to ". - "apply patches with binary data to git. Install the PHP zlib ". - "extension to continue."); + 'This patch has binary data. The PHP zlib extension is required to '. + 'apply patches with binary data to git. Install the PHP zlib '. + 'extension to continue.'); } // See emit_binary_diff_body() in diff.c for git's implementation. diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php --- a/src/parser/ArcanistDiffParser.php +++ b/src/parser/ArcanistDiffParser.php @@ -349,7 +349,7 @@ $this->parseIndexHunk($change); break; default: - $this->didFailParse("Unknown diff type."); + $this->didFailParse('Unknown diff type.'); break; } } while ($this->getLine() !== null); @@ -526,7 +526,7 @@ protected function setIsGit($git) { if ($this->isGit !== null && $this->isGit != $git) { - throw new Exception("Git status has changed!"); + throw new Exception('Git status has changed!'); } $this->isGit = $git; return $this; @@ -817,7 +817,7 @@ $this->nextNonemptyLine(); return; } else if (!preg_match('/^[a-zA-Z]/', $line)) { - $this->didFailParse("Expected base85 line length character (a-zA-Z)."); + $this->didFailParse('Expected base85 line length character (a-zA-Z).'); } } while (true); } @@ -878,7 +878,7 @@ $line = $this->nextNonemptyLine(); $ok = preg_match('/^Property changes on:/', $line); if (!$ok) { - $this->didFailParse("Confused by empty line"); + $this->didFailParse('Confused by empty line'); } $line = $this->nextLine(); return $this->parsePropertyHunk($change); @@ -966,7 +966,7 @@ } if ($old_len || $new_len) { - $this->didFailParse("Found the wrong number of hunk lines."); + $this->didFailParse('Found the wrong number of hunk lines.'); } $corpus = implode('', $real); @@ -1074,7 +1074,7 @@ protected function getLine() { if ($this->text === null) { - throw new Exception("Not parsing!"); + throw new Exception('Not parsing!'); } if (isset($this->text[$this->line])) { return $this->text[$this->line]; @@ -1168,7 +1168,7 @@ $context = ''; for ($ii = $min; $ii <= $max; $ii++) { $context .= sprintf( - "%8.8s %6.6s %s", + '%8.8s %6.6s %s', ($ii == $this->line) ? '>>> ' : '', $ii + 1, $this->text[$ii]); @@ -1182,7 +1182,7 @@ $temp->setPreserveFile(true); Filesystem::writeFile($temp, $this->rawDiff); - $out[] = "Raw input file was written to: ".(string)$temp; + $out[] = 'Raw input file was written to: '.(string)$temp; } $out[] = $context; @@ -1392,7 +1392,7 @@ // 8. ("--") // 9. Patch footer. - list($head, $tail) = preg_split("/^---$/m", $diff, 2); + list($head, $tail) = preg_split('/^---$/m', $diff, 2); list($mail_headers, $mail_body) = explode("\n\n", $head, 2); list($body, $foot) = preg_split('/^-- ?$/m', $tail, 2); list($stat, $diff) = explode("\n\n", $body, 2); diff --git a/src/parser/__tests__/ArcanistBundleTestCase.php b/src/parser/__tests__/ArcanistBundleTestCase.php --- a/src/parser/__tests__/ArcanistBundleTestCase.php +++ b/src/parser/__tests__/ArcanistBundleTestCase.php @@ -148,7 +148,7 @@ foreach ($raw_changes as $change) { $this->assertTrue( empty($changes[$change->getCurrentPath()]), - "Unique Path: ".$change->getCurrentPath()); + 'Unique Path: '.$change->getCurrentPath()); $changes[$change->getCurrentPath()] = $change; } @@ -567,7 +567,7 @@ case '228d7be4840313ed805c25c15bba0f7b188af3e6': // "Add a text file." // This commit is never reached because we skip the 0th commit junk. - $this->assertTrue(true, "This is never reached."); + $this->assertTrue(true, 'This is never reached.'); break; default: throw new Exception( diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php --- a/src/parser/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -583,7 +583,7 @@ $this->assertEqual( ArcanistDiffChangeType::TYPE_MESSAGE, $change->getType()); - $this->assertEqual("WIP", $change->getMetadata('message')); + $this->assertEqual('WIP', $change->getMetadata('message')); $change = array_shift($changes); $this->assertEqual( @@ -620,11 +620,11 @@ public function testGitPathSplitting() { static $tests = array( - "a/old.c b/new.c" => array('old.c', 'new.c'), + 'a/old.c b/new.c' => array('old.c', 'new.c'), "a/old.c b/new.c\n" => array('old.c', 'new.c'), "a/old.c b/new.c\r\n" => array('old.c', 'new.c'), - "old.c new.c" => array('old.c', 'new.c'), - "1/old.c 2/new.c" => array('old.c', 'new.c'), + 'old.c new.c' => array('old.c', 'new.c'), + '1/old.c 2/new.c' => array('old.c', 'new.c'), '"a/\\"quotes1\\"" "b/\\"quotes2\\""' => array( '"quotes1"', '"quotes2"', @@ -637,11 +637,11 @@ "\xE2\x98\x831", "\xE2\x98\x832", ), - "a/Core Data/old.c b/Core Data/new.c" => array( + 'a/Core Data/old.c b/Core Data/new.c' => array( 'Core Data/old.c', 'Core Data/new.c', ), - "some file with spaces.c some file with spaces.c" => array( + 'some file with spaces.c some file with spaces.c' => array( 'some file with spaces.c', 'some file with spaces.c', ), @@ -657,7 +657,7 @@ static $ambiguous = array( - "old file with spaces.c new file with spaces.c", + 'old file with spaces.c new file with spaces.c', ); foreach ($ambiguous as $input) { diff --git a/src/parser/diff/ArcanistDiffChange.php b/src/parser/diff/ArcanistDiffChange.php --- a/src/parser/diff/ArcanistDiffChange.php +++ b/src/parser/diff/ArcanistDiffChange.php @@ -271,7 +271,7 @@ $summary = array(); $summary[] = sprintf( - "%s %5.5s %s", + '%s %5.5s %s', $char, $attr, $this->getCurrentPath()); @@ -289,14 +289,14 @@ public function getSymlinkTarget() { if ($this->getFileType() != ArcanistDiffChangeType::FILE_SYMLINK) { - throw new Exception("Not a symlink!"); + throw new Exception('Not a symlink!'); } $hunks = $this->getHunks(); $hunk = reset($hunks); $corpus = $hunk->getCorpus(); $match = null; if (!preg_match('/^\+(?:link )?(.*)$/m', $corpus, $match)) { - throw new Exception("Failed to extract link target!"); + throw new Exception('Failed to extract link target!'); } return trim($match[1]); } diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -156,7 +156,7 @@ if ($symbolic_commit !== null) { if ($symbolic_commit == ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT) { $this->setBaseCommitExplanation( - "you explicitly specified the empty tree."); + 'you explicitly specified the empty tree.'); return $symbolic_commit; } @@ -187,10 +187,10 @@ if ($this->repositoryHasNoCommits) { $this->setBaseCommitExplanation( - "the repository has no commits."); + 'the repository has no commits.'); } else { $this->setBaseCommitExplanation( - "the repository has only one commit."); + 'the repository has only one commit.'); } return self::GIT_MAGIC_ROOT_COMMIT; @@ -265,7 +265,7 @@ "(Technically: the merge-base of the selected revision and HEAD is ". "used to determine the start of the commit range.)"); - $prompt = "What default do you want to use? [origin/master]"; + $prompt = 'What default do you want to use? [origin/master]'; $default = phutil_console_prompt($prompt); if (!strlen(trim($default))) { @@ -453,13 +453,13 @@ // Convert svn revision number to git hash public function getHashFromFromSVNRevisionNumber($revision_id) { - return $this->executeSVNFindRev("r".$revision_id, "Git"); + return $this->executeSVNFindRev('r'.$revision_id, 'Git'); } // Convert a git hash to svn revision number public function getSVNRevisionNumberFromHash($hash) { - return $this->executeSVNFindRev($hash, "SVN"); + return $this->executeSVNFindRev($hash, 'SVN'); } @@ -710,7 +710,7 @@ $line, $matches); if (!$ok) { - throw new Exception("Failed to parse git ls-tree output!"); + throw new Exception('Failed to parse git ls-tree output!'); } $result[$matches[4]] = array( 'mode' => $matches[1], @@ -836,7 +836,7 @@ public function performLocalBranchMerge($branch, $message) { if (!$branch) { throw new ArcanistUsageException( - "Under git, you must specify the branch you want to merge."); + 'Under git, you must specify the branch you want to merge.'); } $err = phutil_passthru( '(cd %s && git merge --no-ff -m %s %s)', @@ -845,7 +845,7 @@ $branch); if ($err) { - throw new ArcanistUsageException("Merge failed!"); + throw new ArcanistUsageException('Merge failed!'); } } @@ -917,8 +917,8 @@ foreach ($results as $key => $result) { $results[$key]['why'] = - "A git commit or tree hash in the commit range is already attached ". - "to the Differential revision."; + 'A git commit or tree hash in the commit range is already attached '. + 'to the Differential revision.'; } return $results; @@ -953,7 +953,7 @@ } public function getBackoutMessage($commit_hash) { - return "This reverts commit ".$commit_hash."."; + return 'This reverts commit '.$commit_hash.'.'; } public function isGitSubversionRepo() { diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -133,8 +133,8 @@ } } - $this->setBaseCommitExplanation("it is the greatest common ancestor of ". - "the working directory and the commit you specified explicitly."); + $this->setBaseCommitExplanation('it is the greatest common ancestor of '. + 'the working directory and the commit you specified explicitly.'); return $commit; } @@ -174,8 +174,8 @@ if (!$logs) { $this->setBaseCommitExplanation( - "you have no outgoing commits, so arc assumes you intend to submit ". - "uncommitted changes in the working copy."); + 'you have no outgoing commits, so arc assumes you intend to submit '. + 'uncommitted changes in the working copy.'); return $this->getWorkingCopyRevision(); } @@ -217,11 +217,11 @@ if ($against == 'null') { $this->setBaseCommitExplanation( - "this is a new repository (all changes are outgoing)."); + 'this is a new repository (all changes are outgoing).'); } else { $this->setBaseCommitExplanation( - "it is the first commit reachable from the working copy state ". - "which is not outgoing."); + 'it is the first commit reachable from the working copy state '. + 'which is not outgoing.'); } return $against; @@ -231,7 +231,7 @@ if ($this->localCommitInfo === null) { $base_commit = $this->getBaseCommit(); list($info) = $this->execxLocal( - "log --template %s --rev %s --branch %s --", + 'log --template %s --rev %s --branch %s --', "{node}\1{rev}\1{author}\1". "{date|rfc822date}\1{branch}\1{tag}\1{parents}\1{desc}\2", hgsprintf('(%s::. - %s)', $base_commit, $base_commit), @@ -522,13 +522,13 @@ if ($err) { return false; } else { - return (strpos($stdout, "amend") !== false); + return (strpos($stdout, 'amend') !== false); } } public function supportsRebase() { if ($this->supportsRebase === null) { - list ($err) = $this->execManualLocal("help rebase"); + list ($err) = $this->execManualLocal('help rebase'); $this->supportsRebase = $err === 0; } @@ -537,7 +537,7 @@ public function supportsPhases() { if ($this->supportsPhases === null) { - list ($err) = $this->execManualLocal("help phase"); + list ($err) = $this->execManualLocal('help phase'); $this->supportsPhases = $err === 0; } @@ -616,7 +616,7 @@ } if ($err) { - throw new ArcanistUsageException("Merge failed!"); + throw new ArcanistUsageException('Merge failed!'); } } @@ -628,7 +628,7 @@ public function getCommitMessageLog() { $base_commit = $this->getBaseCommit(); list($stdout) = $this->execxLocal( - "log --template %s --rev %s --branch %s --", + 'log --template %s --rev %s --branch %s --', "{node}\1{desc}\2", hgsprintf('(%s::. - %s)', $base_commit, $base_commit), $this->getBranchName()); @@ -698,8 +698,8 @@ foreach ($results as $key => $hash) { $results[$key]['why'] = - "A mercurial commit hash in the commit range is already attached ". - "to the Differential revision."; + 'A mercurial commit hash in the commit range is already attached '. + 'to the Differential revision.'; } return $results; @@ -796,7 +796,7 @@ } public function getBackoutMessage($commit_hash) { - return "Backed out changeset ".$commit_hash."."; + return 'Backed out changeset '.$commit_hash.'.'; } public function resolveBaseCommitRule($rule, $source) { diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php --- a/src/repository/api/ArcanistRepositoryAPI.php +++ b/src/repository/api/ArcanistRepositoryAPI.php @@ -64,7 +64,7 @@ if (!$working_copy) { throw new Exception( pht( - "Trying to create a RepositoryAPI without a working copy!")); + 'Trying to create a RepositoryAPI without a working copy!')); } $root = $working_copy->getProjectRoot(); @@ -81,9 +81,9 @@ default: throw new Exception( pht( - "The current working directory is not part of a working copy for ". - "a supported version control system (Git, Subversion or ". - "Mercurial).")); + 'The current working directory is not part of a working copy for '. + 'a supported version control system (Git, Subversion or '. + 'Mercurial).')); } $api->configurationManager = $configuration_manager; diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php --- a/src/repository/api/ArcanistSubversionAPI.php +++ b/src/repository/api/ArcanistSubversionAPI.php @@ -631,7 +631,7 @@ public function getFinalizedRevisionMessage() { // In other VCSes we give push instructions here, but it never makes sense // in SVN. - return "Done."; + return 'Done.'; } public function loadWorkingCopyDifferentialRevisions( @@ -660,7 +660,7 @@ foreach ($results as $key => $result) { $results[$key]['why'] = - "Matching arcanist project name and working copy directory path."; + 'Matching arcanist project name and working copy directory path.'; } return $results; diff --git a/src/unit/engine/ArcanistXUnitTestResultParser.php b/src/unit/engine/ArcanistXUnitTestResultParser.php --- a/src/unit/engine/ArcanistXUnitTestResultParser.php +++ b/src/unit/engine/ArcanistXUnitTestResultParser.php @@ -32,18 +32,18 @@ } $results = array(); - $testcases = $xunit_dom->getElementsByTagName("testcase"); + $testcases = $xunit_dom->getElementsByTagName('testcase'); foreach ($testcases as $testcase) { - $classname = $testcase->getAttribute("classname"); - $name = $testcase->getAttribute("name"); - $time = $testcase->getAttribute("time"); + $classname = $testcase->getAttribute('classname'); + $name = $testcase->getAttribute('name'); + $time = $testcase->getAttribute('time'); $status = ArcanistUnitTestResult::RESULT_PASS; - $user_data = ""; + $user_data = ''; // A skipped test is a test which was ignored using framework // mechanizms (e.g. @skip decorator) - $skipped = $testcase->getElementsByTagName("skipped"); + $skipped = $testcase->getElementsByTagName('skipped'); if ($skipped->length > 0) { $status = ArcanistUnitTestResult::RESULT_SKIP; $messages = array(); @@ -56,7 +56,7 @@ // Failure is a test which the code has explicitly failed by using // the mechanizms for that purpose. e.g., via an assertEquals - $failures = $testcase->getElementsByTagName("failure"); + $failures = $testcase->getElementsByTagName('failure'); if ($failures->length > 0) { $status = ArcanistUnitTestResult::RESULT_FAIL; $messages = array(); @@ -70,7 +70,7 @@ // An errored test is one that had an unanticipated problem. e.g., an // unchecked throwable, or a problem with an implementation of the // test. - $errors = $testcase->getElementsByTagName("error"); + $errors = $testcase->getElementsByTagName('error'); if ($errors->length > 0) { $status = ArcanistUnitTestResult::RESULT_BROKEN; $messages = array(); @@ -82,7 +82,7 @@ } $result = new ArcanistUnitTestResult(); - $result->setName($classname.".".$name); + $result->setName($classname.'.'.$name); $result->setResult($status); $result->setDuration($time); $result->setUserData($user_data); diff --git a/src/unit/engine/CSharpToolsTestEngine.php b/src/unit/engine/CSharpToolsTestEngine.php --- a/src/unit/engine/CSharpToolsTestEngine.php +++ b/src/unit/engine/CSharpToolsTestEngine.php @@ -50,8 +50,8 @@ $this->coverEngine = Filesystem::resolvePath($cscover); } else { throw new Exception( - "Unable to locate cscover coverage runner ". - "(have you built yet?)"); + 'Unable to locate cscover coverage runner '. + '(have you built yet?)'); } } @@ -95,7 +95,7 @@ // FIXME: Can't use TempFile here as xUnit doesn't like // UNIX-style full paths. It sees the leading / as the // start of an option flag, even when quoted. - $xunit_temp = Filesystem::readRandomCharacters(10).".results.xml"; + $xunit_temp = Filesystem::readRandomCharacters(10).'.results.xml'; if (file_exists($xunit_temp)) { unlink($xunit_temp); } @@ -103,15 +103,15 @@ $cover_temp->setPreserveFile(true); $xunit_cmd = $this->runtimeEngine; $xunit_args = null; - if ($xunit_cmd === "") { + if ($xunit_cmd === '') { $xunit_cmd = $this->testEngine; $xunit_args = csprintf( - "%s /xml %s", + '%s /xml %s', $test_assembly, $xunit_temp); } else { $xunit_args = csprintf( - "%s %s /xml %s", + '%s %s /xml %s', $this->testEngine, $test_assembly, $xunit_temp); @@ -119,7 +119,7 @@ $assembly_dir = dirname($test_assembly); $assemblies_to_instrument = array(); foreach (Filesystem::listDirectory($assembly_dir) as $file) { - if (substr($file, -4) == ".dll" || substr($file, -4) == ".exe") { + if (substr($file, -4) == '.dll' || substr($file, -4) == '.exe') { if ($this->assemblyShouldBeInstrumented($file)) { $assemblies_to_instrument[] = $assembly_dir.DIRECTORY_SEPARATOR.$file; } @@ -129,8 +129,8 @@ return parent::buildTestFuture($test_assembly); } $future = new ExecFuture( - "%C -o %s -c %s -a %s -w %s %Ls", - trim($this->runtimeEngine." ".$this->coverEngine), + '%C -o %s -c %s -a %s -w %s %Ls', + trim($this->runtimeEngine.' '.$this->coverEngine), $cover_temp, $xunit_cmd, $xunit_args, @@ -200,9 +200,9 @@ $results = array(); foreach ($tags as $tag) { $results[] = array( - "file" => $tag->getAttribute("file"), - "start" => $tag->getAttribute("start"), - "end" => $tag->getAttribute("end")); + 'file' => $tag->getAttribute('file'), + 'start' => $tag->getAttribute('start'), + 'end' => $tag->getAttribute('end')); } return $results; } @@ -229,12 +229,12 @@ $executed = array(); $instrumented = $this->processTags( - $coverage_dom->getElementsByTagName("instrumented")); + $coverage_dom->getElementsByTagName('instrumented')); $executed = $this->processTags( - $coverage_dom->getElementsByTagName("executed")); + $coverage_dom->getElementsByTagName('executed')); foreach ($instrumented as $instrument) { - $absolute_file = $instrument["file"]; + $absolute_file = $instrument['file']; $relative_file = substr($absolute_file, strlen($this->projectRoot) + 1); if (!in_array($relative_file, $files)) { $files[] = $relative_file; @@ -254,24 +254,24 @@ } foreach ($instrumented as $instrument) { - if ($instrument["file"] !== $absolute_file) { + if ($instrument['file'] !== $absolute_file) { continue; } for ( - $i = $instrument["start"]; - $i <= $instrument["end"]; + $i = $instrument['start']; + $i <= $instrument['end']; $i++) { $coverage[$i - 1] = 'U'; } } foreach ($executed as $execute) { - if ($execute["file"] !== $absolute_file) { + if ($execute['file'] !== $absolute_file) { continue; } for ( - $i = $execute["start"]; - $i <= $execute["end"]; + $i = $execute['start']; + $i <= $execute['end']; $i++) { $coverage[$i - 1] = 'C'; } diff --git a/src/unit/engine/GoTestResultParser.php b/src/unit/engine/GoTestResultParser.php --- a/src/unit/engine/GoTestResultParser.php +++ b/src/unit/engine/GoTestResultParser.php @@ -28,13 +28,13 @@ $results = array(); // We'll get our full test case name at the end and add it back in - $test_case_name = ""; + $test_case_name = ''; // Temp store for test case results (in case we run multiple test cases) $test_case_results = array(); foreach ($test_results as $i => $line) { - if (strncmp($line, "--- PASS", 8) === 0) { + if (strncmp($line, '--- PASS', 8) === 0) { // We have a passing test $meta = array(); preg_match( @@ -53,7 +53,7 @@ continue; } - if (strncmp($line, "--- FAIL", 8) === 0) { + if (strncmp($line, '--- FAIL', 8) === 0) { // We have a failing test $reason = trim($test_results[$i + 1]); $meta = array(); @@ -73,21 +73,21 @@ continue; } - if (strncmp($line, "ok", 2) === 0) { + if (strncmp($line, 'ok', 2) === 0) { $meta = array(); preg_match( '/^ok[\s\t]+(?P\w.*)[\s\t]+(?P