Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13194218
D9184.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
97 KB
Referenced Files
None
Subscribers
None
D9184.diff
View Options
diff --git a/scripts/test/http.php b/scripts/test/http.php
--- a/scripts/test/http.php
+++ b/scripts/test/http.php
@@ -22,7 +22,7 @@
$uri = $args->getArg('url');
if (count($uri) !== 1) {
throw new PhutilArgumentUsageException(
- "Specify exactly one URL to retrieve.");
+ 'Specify exactly one URL to retrieve.');
}
$uri = head($uri);
diff --git a/scripts/test/progress_bar.php b/scripts/test/progress_bar.php
--- a/scripts/test/progress_bar.php
+++ b/scripts/test/progress_bar.php
@@ -46,7 +46,7 @@
->setTotal(100);
for ($ii = 0; $ii < 100; $ii++) {
if ($ii == 20) {
- throw new Exception("Boo!");
+ throw new Exception('Boo!');
}
$bar->update(1);
usleep(10000);
diff --git a/scripts/utils/lock.php b/scripts/utils/lock.php
--- a/scripts/utils/lock.php
+++ b/scripts/utils/lock.php
@@ -65,7 +65,7 @@
}
}
-while (!$console->confirm("Release lock?")) {
+while (!$console->confirm('Release lock?')) {
// Keep asking until they say yes.
}
diff --git a/scripts/utils/utf8.php b/scripts/utils/utf8.php
--- a/scripts/utils/utf8.php
+++ b/scripts/utils/utf8.php
@@ -94,9 +94,9 @@
$data = read($file);
$ok = phutil_is_utf8($data);
if ($ok) {
- echo "OKAY";
+ echo 'OKAY';
} else {
- echo "FAIL";
+ echo 'FAIL';
}
echo " ".name($file)."\n";
@@ -158,7 +158,7 @@
$out .= $match[1];
$line = substr($line, strlen($match[1]));
} else {
- $chr = sprintf("<0x%0X>", ord($line[0]));
+ $chr = sprintf('<0x%0X>', ord($line[0]));
$chr = phutil_console_format('##%s##', $chr);
$out .= $chr;
$line = substr($line, 1);
diff --git a/src/__phutil_library_init__.php b/src/__phutil_library_init__.php
--- a/src/__phutil_library_init__.php
+++ b/src/__phutil_library_init__.php
@@ -145,7 +145,7 @@
switch ($version) {
case 1:
throw new Exception(
- "libphutil v1 libraries are no longer supported.");
+ 'libphutil v1 libraries are no longer supported.');
case 2:
// NOTE: In version 2 of the library format, all parents (both
// classes and interfaces) are stored in the 'xmap'. The value is
diff --git a/src/aphront/storage/connection/AphrontDatabaseConnection.php b/src/aphront/storage/connection/AphrontDatabaseConnection.php
--- a/src/aphront/storage/connection/AphrontDatabaseConnection.php
+++ b/src/aphront/storage/connection/AphrontDatabaseConnection.php
@@ -38,11 +38,11 @@
}
public function asyncQuery($raw_query) {
- throw new Exception("Async queries are not supported.");
+ throw new Exception('Async queries are not supported.');
}
public static function resolveAsyncQueries(array $conns, array $asyncs) {
- throw new Exception("Async queries are not supported.");
+ throw new Exception('Async queries are not supported.');
}
diff --git a/src/aphront/storage/connection/AphrontDatabaseTransactionState.php b/src/aphront/storage/connection/AphrontDatabaseTransactionState.php
--- a/src/aphront/storage/connection/AphrontDatabaseTransactionState.php
+++ b/src/aphront/storage/connection/AphrontDatabaseTransactionState.php
@@ -39,7 +39,7 @@
public function endReadLocking() {
if ($this->readLockLevel == 0) {
- throw new Exception("Too many calls to endReadLocking()!");
+ throw new Exception('Too many calls to endReadLocking()!');
}
$this->readLockLevel--;
return $this;
@@ -56,7 +56,7 @@
public function endWriteLocking() {
if ($this->writeLockLevel == 0) {
- throw new Exception("Too many calls to endWriteLocking()!");
+ throw new Exception('Too many calls to endWriteLocking()!');
}
$this->writeLockLevel--;
return $this;
diff --git a/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnection.php b/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnection.php
--- a/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnection.php
+++ b/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnection.php
@@ -34,8 +34,8 @@
// installed, which has bitten me on three separate occasions. Make sure
// such failures are explicit and loud.
throw new Exception(
- "About to call mysql_connect(), but the PHP MySQL extension is not ".
- "available!");
+ 'About to call mysql_connect(), but the PHP MySQL extension is not '.
+ 'available!');
}
$user = $this->getConfiguration('user');
@@ -117,7 +117,7 @@
}
if (!$processed_all) {
- throw new Exception("There are some results left in the result set.");
+ throw new Exception('There are some results left in the result set.');
}
return $results;
diff --git a/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php b/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
--- a/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
+++ b/src/aphront/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
@@ -32,8 +32,8 @@
protected function connect() {
if (!class_exists('mysqli', false)) {
throw new Exception(
- "About to call new mysqli(), but the PHP MySQLi extension is not ".
- "available!");
+ 'About to call new mysqli(), but the PHP MySQLi extension is not '.
+ 'available!');
}
$user = $this->getConfiguration('user');
@@ -103,7 +103,7 @@
}
if ($conn->more_results()) {
- throw new Exception("There are some results left in the result set.");
+ throw new Exception('There are some results left in the result set.');
}
return $results;
diff --git a/src/aphront/storage/exception/AphrontQueryParameterException.php b/src/aphront/storage/exception/AphrontQueryParameterException.php
--- a/src/aphront/storage/exception/AphrontQueryParameterException.php
+++ b/src/aphront/storage/exception/AphrontQueryParameterException.php
@@ -8,7 +8,7 @@
private $query;
public function __construct($query, $message) {
- parent::__construct($message." Query: ".$query);
+ parent::__construct($message.' Query: '.$query);
$this->query = $query;
}
diff --git a/src/aphront/writeguard/AphrontWriteGuard.php b/src/aphront/writeguard/AphrontWriteGuard.php
--- a/src/aphront/writeguard/AphrontWriteGuard.php
+++ b/src/aphront/writeguard/AphrontWriteGuard.php
@@ -67,14 +67,14 @@
public function __construct($callback) {
if (self::$instance) {
throw new Exception(
- "An AphrontWriteGuard already exists. Dispose of the previous guard ".
- "before creating a new one.");
+ 'An AphrontWriteGuard already exists. Dispose of the previous guard '.
+ 'before creating a new one.');
}
if (self::$allowUnguardedWrites) {
throw new Exception(
- "An AphrontWriteGuard is being created in a context which permits ".
- "unguarded writes unconditionally. This is not allowed and indicates ".
- "a serious error.");
+ 'An AphrontWriteGuard is being created in a context which permits '.
+ 'unguarded writes unconditionally. This is not allowed and indicates '.
+ 'a serious error.');
}
if (!self::$abruptExitlistenerIsInstalled) {
self::$abruptExitlistenerIsInstalled = true;
@@ -96,13 +96,13 @@
public function dispose() {
if (!self::$instance) {
throw new Exception(
- "Attempting to dispose of write guard, but no write guard is active!");
+ 'Attempting to dispose of write guard, but no write guard is active!');
}
if ($this->allowDepth > 0) {
throw new Exception(
- "Imbalanced AphrontWriteGuard: more beginUnguardedWrites() calls than ".
- "endUnguardedWrites() calls.");
+ 'Imbalanced AphrontWriteGuard: more beginUnguardedWrites() calls than '.
+ 'endUnguardedWrites() calls.');
}
self::$instance = null;
}
@@ -164,8 +164,8 @@
if (!self::$instance) {
if (!self::$allowUnguardedWrites) {
throw new Exception(
- "Unguarded write! There must be an active AphrontWriteGuard to ".
- "perform writes.");
+ 'Unguarded write! There must be an active AphrontWriteGuard to '.
+ 'perform writes.');
} else {
// Unguarded writes are being allowed unconditionally.
return;
@@ -239,8 +239,8 @@
}
if (self::$instance->allowDepth <= 0) {
throw new Exception(
- "Imbalanced AphrontWriteGuard: more endUnguardedWrites() calls than ".
- "beginUnguardedWrites() calls.");
+ 'Imbalanced AphrontWriteGuard: more endUnguardedWrites() calls than '.
+ 'beginUnguardedWrites() calls.');
}
self::$instance->allowDepth--;
}
@@ -261,9 +261,9 @@
public static function allowDangerousUnguardedWrites($allow) {
if (self::$instance) {
throw new Exception(
- "You can not unconditionally disable AphrontWriteGuard by calling ".
- "allowDangerousUnguardedWrites() while a write guard is active. Use ".
- "beginUnguardedWrites() to temporarily allow unguarded writes.");
+ 'You can not unconditionally disable AphrontWriteGuard by calling '.
+ 'allowDangerousUnguardedWrites() while a write guard is active. Use '.
+ 'beginUnguardedWrites() to temporarily allow unguarded writes.');
}
self::$allowUnguardedWrites = true;
}
@@ -280,9 +280,9 @@
public function __destruct() {
if (isset(self::$instance)) {
throw new Exception(
- "AphrontWriteGuard was not properly disposed of! Call dispose() on ".
- "every AphrontWriteGuard object you instantiate or use phutil_exit() ".
- "to exit abruptly while debugging.");
+ 'AphrontWriteGuard was not properly disposed of! Call dispose() on '.
+ 'every AphrontWriteGuard object you instantiate or use phutil_exit() '.
+ 'to exit abruptly while debugging.');
}
}
}
diff --git a/src/auth/PhutilAuthAdapterLDAP.php b/src/auth/PhutilAuthAdapterLDAP.php
--- a/src/auth/PhutilAuthAdapterLDAP.php
+++ b/src/auth/PhutilAuthAdapterLDAP.php
@@ -354,7 +354,7 @@
if (!$ok) {
$this->raiseConnectionException(
$conn,
- pht("Unable to start TLS connection when connecting to LDAP."));
+ pht('Unable to start TLS connection when connecting to LDAP.'));
}
}
@@ -412,7 +412,7 @@
if (!$result) {
$this->raiseConnectionException(
$conn,
- pht("LDAP search failed."));
+ pht('LDAP search failed.'));
}
$entries = @ldap_get_entries($conn, $result);
@@ -420,7 +420,7 @@
if (!$entries) {
$this->raiseConnectionException(
$conn,
- pht("Failed to get LDAP entries from search result."));
+ pht('Failed to get LDAP entries from search result.'));
}
$results = array();
@@ -448,7 +448,7 @@
$error);
} else {
$full_message = pht(
- "LDAP Exception: %s",
+ 'LDAP Exception: %s',
$message);
}
diff --git a/src/auth/PhutilAuthAdapterOAuth.php b/src/auth/PhutilAuthAdapterOAuth.php
--- a/src/auth/PhutilAuthAdapterOAuth.php
+++ b/src/auth/PhutilAuthAdapterOAuth.php
@@ -152,7 +152,7 @@
$code = $this->getCode();
if (!$code) {
throw new Exception(
- "Call setCode() before accessing adapter information.");
+ 'Call setCode() before accessing adapter information.');
}
$params = array(
@@ -192,7 +192,7 @@
}
if (isset($data['error'])) {
- throw new Exception("Access token error: ".$data['error']);
+ throw new Exception('Access token error: '.$data['error']);
}
return $data;
diff --git a/src/auth/PhutilAuthAdapterOAuth1.php b/src/auth/PhutilAuthAdapterOAuth1.php
--- a/src/auth/PhutilAuthAdapterOAuth1.php
+++ b/src/auth/PhutilAuthAdapterOAuth1.php
@@ -101,7 +101,7 @@
if (strlen($consumer_key)) {
$future->setConsumerKey($consumer_key);
} else {
- throw new Exception("setConsumerKey() is required!");
+ throw new Exception('setConsumerKey() is required!');
}
$consumer_secret = $this->getConsumerSecret();
@@ -137,7 +137,7 @@
// NOTE: Per the spec, this value MUST be the string 'true'.
$confirmed = idx($data, 'oauth_callback_confirmed');
- if ($confirmed !== "true") {
+ if ($confirmed !== 'true') {
throw new Exception(
"Expected 'oauth_callback_confirmed' to be 'true'!");
}
@@ -154,10 +154,10 @@
$this->willFinishOAuthHandshake();
if (!$this->getToken()) {
- throw new Exception("Expected token to finish OAuth handshake!");
+ throw new Exception('Expected token to finish OAuth handshake!');
}
if (!$this->getVerifier()) {
- throw new Exception("Expected verifier to finish OAuth handshake!");
+ throw new Exception('Expected verifier to finish OAuth handshake!');
}
$validate_uri = $this->getValidateTokenURI();
diff --git a/src/auth/PhutilAuthAdapterOAuthAmazon.php b/src/auth/PhutilAuthAdapterOAuthAmazon.php
--- a/src/auth/PhutilAuthAdapterOAuthAmazon.php
+++ b/src/auth/PhutilAuthAdapterOAuthAmazon.php
@@ -71,8 +71,8 @@
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception(
- "Expected valid JSON response from Amazon account data request, ".
- "got: ".$body);
+ 'Expected valid JSON response from Amazon account data request, '.
+ 'got: '.$body);
}
return $data;
diff --git a/src/auth/PhutilAuthAdapterOAuthDisqus.php b/src/auth/PhutilAuthAdapterOAuthDisqus.php
--- a/src/auth/PhutilAuthAdapterOAuthDisqus.php
+++ b/src/auth/PhutilAuthAdapterOAuthDisqus.php
@@ -74,8 +74,8 @@
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception(
- "Expected valid JSON response from Disqus account data request, ".
- "got: ".$body);
+ 'Expected valid JSON response from Disqus account data request, '.
+ 'got: '.$body);
}
return $data['response'];
diff --git a/src/auth/PhutilAuthAdapterOAuthFacebook.php b/src/auth/PhutilAuthAdapterOAuthFacebook.php
--- a/src/auth/PhutilAuthAdapterOAuthFacebook.php
+++ b/src/auth/PhutilAuthAdapterOAuthFacebook.php
@@ -91,17 +91,17 @@
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception(
- "Expected valid JSON response from Facebook account data request, ".
- "got: ".$body);
+ 'Expected valid JSON response from Facebook account data request, '.
+ 'got: '.$body);
}
if ($this->requireSecureBrowsing) {
if (empty($data['security_settings']['secure_browsing']['enabled'])) {
throw new Exception(
pht(
- "This Phabricator install requires you to enable Secure Browsing ".
- "on your Facebook account in order to use it to log in to ".
- "Phabricator. For more information, see %s",
+ 'This Phabricator install requires you to enable Secure Browsing '.
+ 'on your Facebook account in order to use it to log in to '.
+ 'Phabricator. For more information, see %s',
'https://www.facebook.com/help/156201551113407/'));
}
}
diff --git a/src/auth/PhutilAuthAdapterOAuthGitHub.php b/src/auth/PhutilAuthAdapterOAuthGitHub.php
--- a/src/auth/PhutilAuthAdapterOAuthGitHub.php
+++ b/src/auth/PhutilAuthAdapterOAuthGitHub.php
@@ -63,8 +63,8 @@
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception(
- "Expected valid JSON response from GitHub account data request, ".
- "got: ".$body);
+ 'Expected valid JSON response from GitHub account data request, '.
+ 'got: '.$body);
}
return $data;
diff --git a/src/auth/PhutilAuthAdapterOAuthGoogle.php b/src/auth/PhutilAuthAdapterOAuthGoogle.php
--- a/src/auth/PhutilAuthAdapterOAuthGoogle.php
+++ b/src/auth/PhutilAuthAdapterOAuthGoogle.php
@@ -108,8 +108,8 @@
$data = json_decode($body, true);
if (!is_array($data)) {
throw new Exception(
- "Expected valid JSON response from Google account data request, ".
- "got: ".$body);
+ 'Expected valid JSON response from Google account data request, '.
+ 'got: '.$body);
}
return $data;
diff --git a/src/auth/PhutilAuthAdapterOAuthJIRA.php b/src/auth/PhutilAuthAdapterOAuthJIRA.php
--- a/src/auth/PhutilAuthAdapterOAuthJIRA.php
+++ b/src/auth/PhutilAuthAdapterOAuthJIRA.php
@@ -135,7 +135,7 @@
* well known `oauth_verifier` value ("denied"), which we check for here.
*/
protected function willFinishOAuthHandshake() {
- $jira_magic_word = "denied";
+ $jira_magic_word = 'denied';
if ($this->getVerifier() == $jira_magic_word) {
throw new PhutilAuthUserAbortedException();
}
diff --git a/src/cache/PhutilKeyValueCacheDirectory.php b/src/cache/PhutilKeyValueCacheDirectory.php
--- a/src/cache/PhutilKeyValueCacheDirectory.php
+++ b/src/cache/PhutilKeyValueCacheDirectory.php
@@ -171,7 +171,7 @@
private function getCacheDirectory() {
if (!$this->cacheDirectory) {
throw new Exception(
- "Call setCacheDirectory() before using a directory cache!");
+ 'Call setCacheDirectory() before using a directory cache!');
}
return $this->cacheDirectory;
}
diff --git a/src/cache/PhutilKeyValueCacheMemcache.php b/src/cache/PhutilKeyValueCacheMemcache.php
--- a/src/cache/PhutilKeyValueCacheMemcache.php
+++ b/src/cache/PhutilKeyValueCacheMemcache.php
@@ -115,7 +115,7 @@
$n = count($this->servers);
if (!$n) {
- throw new Exception("Call setServers() before using Memcache!");
+ throw new Exception('Call setServers() before using Memcache!');
}
foreach ($keys as $key) {
diff --git a/src/cache/PhutilKeyValueCacheOnDisk.php b/src/cache/PhutilKeyValueCacheOnDisk.php
--- a/src/cache/PhutilKeyValueCacheOnDisk.php
+++ b/src/cache/PhutilKeyValueCacheOnDisk.php
@@ -196,7 +196,7 @@
*/
private function getCacheFile() {
if (!$this->cacheFile) {
- throw new Exception("Call setCacheFile() before using a disk cache!");
+ throw new Exception('Call setCacheFile() before using a disk cache!');
}
return $this->cacheFile;
}
diff --git a/src/cache/__tests__/PhutilKeyValueCacheTestCase.php b/src/cache/__tests__/PhutilKeyValueCacheTestCase.php
--- a/src/cache/__tests__/PhutilKeyValueCacheTestCase.php
+++ b/src/cache/__tests__/PhutilKeyValueCacheTestCase.php
@@ -49,7 +49,7 @@
public function testAPCCache() {
$cache = new PhutilKeyValueCacheAPC();
if (!$cache->isAvailable()) {
- $this->assertSkipped("Cache not available.");
+ $this->assertSkipped('Cache not available.');
}
$this->doCacheTest($cache);
}
diff --git a/src/channel/PhutilChannel.php b/src/channel/PhutilChannel.php
--- a/src/channel/PhutilChannel.php
+++ b/src/channel/PhutilChannel.php
@@ -74,7 +74,7 @@
*/
public function write($bytes) {
if (!is_scalar($bytes)) {
- throw new Exception("PhutilChannel->write() may only write strings!");
+ throw new Exception('PhutilChannel->write() may only write strings!');
}
$this->obuf->append($bytes);
@@ -416,7 +416,7 @@
while (!$this->isWriteBufferEmpty()) {
self::waitForAny(array($this));
if (!$this->update()) {
- throw new Exception("Channel closed while flushing output!");
+ throw new Exception('Channel closed while flushing output!');
}
}
return $this;
diff --git a/src/channel/PhutilChannelChannel.php b/src/channel/PhutilChannelChannel.php
--- a/src/channel/PhutilChannelChannel.php
+++ b/src/channel/PhutilChannelChannel.php
@@ -102,8 +102,8 @@
// protected.
throw new Exception(
- "Do not call readBytes() or writeBytes() directly on a ".
- "PhutilChannelChannel. Instead, call read() or write().");
+ 'Do not call readBytes() or writeBytes() directly on a '.
+ 'PhutilChannelChannel. Instead, call read() or write().');
}
}
diff --git a/src/channel/PhutilExecChannel.php b/src/channel/PhutilExecChannel.php
--- a/src/channel/PhutilExecChannel.php
+++ b/src/channel/PhutilExecChannel.php
@@ -115,7 +115,7 @@
}
protected function writeBytes($bytes) {
- throw new Exception("ExecFuture can not write bytes directly!");
+ throw new Exception('ExecFuture can not write bytes directly!');
}
protected function getReadSockets() {
diff --git a/src/channel/PhutilProtocolChannel.php b/src/channel/PhutilProtocolChannel.php
--- a/src/channel/PhutilProtocolChannel.php
+++ b/src/channel/PhutilProtocolChannel.php
@@ -135,7 +135,7 @@
self::waitForAny(array($this));
}
- throw new Exception("Channel closed while waiting for message!");
+ throw new Exception('Channel closed while waiting for message!');
}
}
diff --git a/src/channel/PhutilSocketChannel.php b/src/channel/PhutilSocketChannel.php
--- a/src/channel/PhutilSocketChannel.php
+++ b/src/channel/PhutilSocketChannel.php
@@ -50,7 +50,7 @@
}
$ok = stream_set_blocking($socket, false);
if (!$ok) {
- throw new Exception("Failed to set socket nonblocking!");
+ throw new Exception('Failed to set socket nonblocking!');
}
}
@@ -82,7 +82,7 @@
$domain = phutil_is_windows() ? STREAM_PF_INET : STREAM_PF_UNIX;
$pair = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
if (!$pair) {
- throw new Exception("stream_socket_pair() failed!");
+ throw new Exception('stream_socket_pair() failed!');
}
$x = new PhutilSocketChannel($pair[0]);
diff --git a/src/channel/__tests__/PhutilJSONProtocolChannelTestCase.php b/src/channel/__tests__/PhutilJSONProtocolChannelTestCase.php
--- a/src/channel/__tests__/PhutilJSONProtocolChannelTestCase.php
+++ b/src/channel/__tests__/PhutilJSONProtocolChannelTestCase.php
@@ -20,7 +20,7 @@
$this->assertEqual(
$dict,
$result,
- "Values are identical.");
+ 'Values are identical.');
}
}
diff --git a/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php b/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php
--- a/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php
+++ b/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php
@@ -17,11 +17,11 @@
$this->assertTrue(
(array)$object === (array)$result,
- "Values are identical.");
+ 'Values are identical.');
$this->assertFalse(
$object === $result,
- "Objects are not the same.");
+ 'Objects are not the same.');
}
public function testCloseSocketWriteChannel() {
@@ -51,7 +51,7 @@
$future->setTimeout(5);
$exec_channel = new PhutilExecChannel($future);
- $exec_channel->write("quack");
+ $exec_channel->write('quack');
$exec_channel->closeWriteChannel();
// If `closeWriteChannel()` did what it is supposed to, this will just
diff --git a/src/console/PhutilConsole.php b/src/console/PhutilConsole.php
--- a/src/console/PhutilConsole.php
+++ b/src/console/PhutilConsole.php
@@ -216,7 +216,7 @@
} else if ($this->messages) {
$message = array_shift($this->messages);
} else {
- throw new Exception("waitForMessage() called with no messages!");
+ throw new Exception('waitForMessage() called with no messages!');
}
return $message;
diff --git a/src/console/PhutilConsoleFormatter.php b/src/console/PhutilConsoleFormatter.php
--- a/src/console/PhutilConsoleFormatter.php
+++ b/src/console/PhutilConsoleFormatter.php
@@ -25,8 +25,8 @@
public static function getDisableANSI() {
if (self::$disableANSI === null) {
- $term = phutil_utf8_strtolower(getenv("TERM"));
- if (phutil_is_windows() && $term !== "cygwin" && $term !== "ansi") {
+ $term = phutil_utf8_strtolower(getenv('TERM'));
+ if (phutil_is_windows() && $term !== 'cygwin' && $term !== 'ansi') {
self::$disableANSI = true;
} else if (function_exists('posix_isatty') && !posix_isatty(STDOUT)) {
self::$disableANSI = true;
diff --git a/src/console/PhutilConsoleProgressBar.php b/src/console/PhutilConsoleProgressBar.php
--- a/src/console/PhutilConsoleProgressBar.php
+++ b/src/console/PhutilConsoleProgressBar.php
@@ -110,7 +110,7 @@
sprintf('%.1f', 100 * $percent));
$this->eraseLine();
- $console->writeErr("%s", $out);
+ $console->writeErr('%s', $out);
}
public function done($clean_exit = true) {
@@ -118,7 +118,7 @@
if ($this->drawn) {
$this->eraseLine();
if ($clean_exit) {
- $console->writeErr("%s\n", "Done.");
+ $console->writeErr("%s\n", 'Done.');
}
}
$this->finished = true;
diff --git a/src/console/PhutilConsoleStdinNotInteractiveException.php b/src/console/PhutilConsoleStdinNotInteractiveException.php
--- a/src/console/PhutilConsoleStdinNotInteractiveException.php
+++ b/src/console/PhutilConsoleStdinNotInteractiveException.php
@@ -11,7 +11,7 @@
final class PhutilConsoleStdinNotInteractiveException extends Exception {
public function __construct() {
parent::__construct(
- "The program is attempting to read user input, but stdin is being piped ".
- "from some other source (not a TTY).");
+ 'The program is attempting to read user input, but stdin is being piped '.
+ 'from some other source (not a TTY).');
}
}
diff --git a/src/console/PhutilInteractiveEditor.php b/src/console/PhutilInteractiveEditor.php
--- a/src/console/PhutilInteractiveEditor.php
+++ b/src/console/PhutilInteractiveEditor.php
@@ -268,7 +268,7 @@
}
throw new Exception(
- "Unable to launch an interactive text editor. Set the EDITOR ".
- "environment variable to an appropriate editor.");
+ 'Unable to launch an interactive text editor. Set the EDITOR '.
+ 'environment variable to an appropriate editor.');
}
}
diff --git a/src/console/__tests__/PhutilConsoleWrapTestCase.php b/src/console/__tests__/PhutilConsoleWrapTestCase.php
--- a/src/console/__tests__/PhutilConsoleWrapTestCase.php
+++ b/src/console/__tests__/PhutilConsoleWrapTestCase.php
@@ -26,9 +26,9 @@
"abc abc!"),
phutil_console_wrap(
phutil_console_format(
- "<bg:red>** ERROR **</bg> abc abc abc abc abc abc abc abc abc abc ".
- "abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc ".
- "abc abc!")),
+ '<bg:red>** ERROR **</bg> abc abc abc abc abc abc abc abc abc abc '.
+ 'abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc '.
+ 'abc abc!')),
'ANSI escape sequences should not contribute toward wrap width.');
}
diff --git a/src/console/format.php b/src/console/format.php
--- a/src/console/format.php
+++ b/src/console/format.php
@@ -148,7 +148,7 @@
}
}
- if ($chr == " ") {
+ if ($chr == ' ') {
$break_pos = count($line);
$len_after_break = 0;
}
diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php
--- a/src/daemon/PhutilDaemonOverseer.php
+++ b/src/daemon/PhutilDaemonOverseer.php
@@ -126,7 +126,7 @@
if (self::$instance) {
throw new Exception(
- "You may not instantiate more than one Overseer per process.");
+ 'You may not instantiate more than one Overseer per process.');
}
self::$instance = $this;
@@ -141,7 +141,7 @@
$pid = pcntl_fork();
if ($pid === -1) {
- throw new Exception("Unable to fork!");
+ throw new Exception('Unable to fork!');
} else if ($pid) {
exit(0);
}
diff --git a/src/error/PhutilErrorHandler.php b/src/error/PhutilErrorHandler.php
--- a/src/error/PhutilErrorHandler.php
+++ b/src/error/PhutilErrorHandler.php
@@ -394,8 +394,8 @@
static $handling_error;
if ($handling_error) {
error_log(
- "Error handler was reentered, some errors were not passed to the ".
- "listener.");
+ 'Error handler was reentered, some errors were not passed to the '.
+ 'listener.');
return;
}
$handling_error = true;
diff --git a/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php b/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php
--- a/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php
+++ b/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php
@@ -37,7 +37,7 @@
}
private function throwTrace($v) {
- throw new Exception("!");
+ throw new Exception('!');
}
private function getBacktrace($v) {
diff --git a/src/error/phlog.php b/src/error/phlog.php
--- a/src/error/phlog.php
+++ b/src/error/phlog.php
@@ -61,5 +61,5 @@
* @group error
*/
function phutil_error_listener_example($event, $value, array $metadata) {
- throw new Exception("This is just an example function!");
+ throw new Exception('This is just an example function!');
}
diff --git a/src/filesystem/FileFinder.php b/src/filesystem/FileFinder.php
--- a/src/filesystem/FileFinder.php
+++ b/src/filesystem/FileFinder.php
@@ -138,7 +138,7 @@
}
foreach ($found as $filename) {
// Only exclude files whose names match relative to the root.
- if ($dir == "") {
+ if ($dir == '') {
$matches = true;
foreach ($this->exclude as $exclude_path) {
if (fnmatch(ltrim($exclude_path, './'), $dir.$filename)) {
@@ -178,16 +178,16 @@
"with an absolute path.");
}
- if ($this->forceMode == "shell") {
+ if ($this->forceMode == 'shell') {
$php_mode = false;
- } else if ($this->forceMode == "php") {
+ } else if ($this->forceMode == 'php') {
$php_mode = true;
} else {
$php_mode = (phutil_is_windows() || !Filesystem::binaryExists('find'));
}
if ($php_mode) {
- $files = $this->getFiles("");
+ $files = $this->getFiles('');
} else {
$args = array();
$command = array();
diff --git a/src/filesystem/Filesystem.php b/src/filesystem/Filesystem.php
--- a/src/filesystem/Filesystem.php
+++ b/src/filesystem/Filesystem.php
@@ -190,14 +190,14 @@
if ($ok === false) {
throw new FilesystemException(
$try_path,
- pht("Failed to write file data."));
+ pht('Failed to write file data.'));
}
$ok = fclose($handle);
if (!$ok) {
throw new FilesystemException(
$try_path,
- pht("Failed to close file handle."));
+ pht('Failed to close file handle.'));
}
return $try_path;
@@ -265,7 +265,7 @@
public static function remove($path) {
if (!strlen($path)) {
// Avoid removing PWD.
- throw new Exception("No path provided to remove().");
+ throw new Exception('No path provided to remove().');
}
$path = self::resolvePath($path);
@@ -347,7 +347,7 @@
self::assertExists($path);
if (!@chmod($path, $umask)) {
- $readable_umask = sprintf("%04o", $umask);
+ $readable_umask = sprintf('%04o', $umask);
throw new FilesystemException(
$path, "Failed to chmod `{$path}' to `{$readable_umask}'.");
}
@@ -392,7 +392,7 @@
public static function readRandomBytes($number_of_bytes) {
$number_of_bytes = (int)$number_of_bytes;
if ($number_of_bytes < 1) {
- throw new Exception(pht("You must generate at least 1 byte of entropy."));
+ throw new Exception(pht('You must generate at least 1 byte of entropy.'));
}
// Try to use `openssl_random_psuedo_bytes()` if it's available. This source
@@ -671,7 +671,7 @@
if ($df !== false && $df < 1024 * 1024) {
throw new FilesystemException(
$dir,
- pht("Failed to create a temporary directory: the disk is full."));
+ pht('Failed to create a temporary directory: the disk is full.'));
}
throw new FilesystemException(
diff --git a/src/filesystem/PhutilDeferredLog.php b/src/filesystem/PhutilDeferredLog.php
--- a/src/filesystem/PhutilDeferredLog.php
+++ b/src/filesystem/PhutilDeferredLog.php
@@ -123,7 +123,7 @@
public function setFile($file) {
if ($this->didWrite) {
throw new Exception(
- "You can not change the logfile after a write has occurred!");
+ 'You can not change the logfile after a write has occurred!');
}
$this->file = $file;
return $this;
diff --git a/src/filesystem/PhutilFileLock.php b/src/filesystem/PhutilFileLock.php
--- a/src/filesystem/PhutilFileLock.php
+++ b/src/filesystem/PhutilFileLock.php
@@ -107,12 +107,12 @@
protected function doUnlock() {
$ok = flock($this->handle, LOCK_UN | LOCK_NB);
if (!$ok) {
- throw new Exception("Unable to unlock file!");
+ throw new Exception('Unable to unlock file!');
}
$ok = fclose($this->handle);
if (!$ok) {
- throw new Exception("Unable to close file!");
+ throw new Exception('Unable to close file!');
}
$this->handle = null;
diff --git a/src/filesystem/__tests__/FileFinderTestCase.php b/src/filesystem/__tests__/FileFinderTestCase.php
--- a/src/filesystem/__tests__/FileFinderTestCase.php
+++ b/src/filesystem/__tests__/FileFinderTestCase.php
@@ -8,8 +8,8 @@
protected function findFiles($root, $checksums, $type, $path, $mode) {
$finder = new FileFinder($root);
$finder->setGenerateChecksums($checksums)
- ->excludePath("./exclude")
- ->excludePath("subdir.txt")
+ ->excludePath('./exclude')
+ ->excludePath('subdir.txt')
->withType($type)
->withPath($path)
->withSuffix('txt')
@@ -20,7 +20,7 @@
public function testFinderWithChecksums() {
$root = dirname(__FILE__) . '/data';
- foreach (array("php", "shell") as $mode) {
+ foreach (array('php', 'shell') as $mode) {
$files = $this->findFiles($root, true, 'f', '*', $mode);
// Test whether correct files were found.
@@ -52,7 +52,7 @@
public function testFinderWithoutChecksums() {
$root = dirname(__FILE__) . '/data';
- foreach (array("php", "shell") as $mode) {
+ foreach (array('php', 'shell') as $mode) {
$files = $this->findFiles($root, false, 'f', '*', $mode);
// Test whether correct files were found.
@@ -73,7 +73,7 @@
public function testFinderWithDirectories() {
$root = dirname(__FILE__) . '/data';
- foreach (array("php", "shell") as $mode) {
+ foreach (array('php', 'shell') as $mode) {
$files = $this->findFiles($root, true, '', '*', $mode);
// Test whether the correct files were found.
@@ -96,7 +96,7 @@
public function testFinderWithPath() {
$root = dirname(__FILE__) . '/data';
- foreach (array("php", "shell") as $mode) {
+ foreach (array('php', 'shell') as $mode) {
$files = $this->findFiles($root, true, 'f',
'*/include_dir.txt/subdir.txt/alsoinclude.txt', $mode);
diff --git a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
--- a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
+++ b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
@@ -8,12 +8,12 @@
public function testLogging() {
$this->checkLog(
"derp\n",
- "derp",
+ 'derp',
array());
$this->checkLog(
"[20 Aug 1984] alincoln\n",
- "[%T] %u",
+ '[%T] %u',
array(
'T' => '20 Aug 1984',
'u' => 'alincoln',
@@ -21,14 +21,14 @@
$this->checkLog(
"%%%%%\n",
- "%%%%%%%%%%",
+ '%%%%%%%%%%',
array(
'%' => '%',
));
$this->checkLog(
"\\000\\001\\002\n",
- "%a%b%c",
+ '%a%b%c',
array(
'a' => chr(0),
'b' => chr(1),
@@ -37,21 +37,21 @@
$this->checkLog(
"Download: 100%\n",
- "Download: %C",
+ 'Download: %C',
array(
'C' => '100%',
));
$this->checkLog(
"- bee -\n",
- "%a %b %c",
+ '%a %b %c',
array(
'b' => 'bee',
));
$this->checkLog(
"\\\\\n",
- "%b",
+ '%b',
array(
'b' => '\\',
));
@@ -73,7 +73,7 @@
$this->checkLog(
"a % xb\n",
- "%a %% x%b",
+ '%a %% x%b',
array(
'a' => 'a',
'b' => 'b',
@@ -109,7 +109,7 @@
$futures = array();
for ($ii = 0; $ii < $n_writers; $ii++) {
- $futures[] = new ExecFuture("%s %d %s", $bin, $n_lines, (string)$tmp);
+ $futures[] = new ExecFuture('%s %d %s', $bin, $n_lines, (string)$tmp);
}
Futures($futures)->resolveAll();
diff --git a/src/filesystem/__tests__/PhutilFileLockTestCase.php b/src/filesystem/__tests__/PhutilFileLockTestCase.php
--- a/src/filesystem/__tests__/PhutilFileLockTestCase.php
+++ b/src/filesystem/__tests__/PhutilFileLockTestCase.php
@@ -177,7 +177,7 @@
}
}
- throw new Exception("Unable to hold lock in external process!");
+ throw new Exception('Unable to hold lock in external process!');
}
private function buildLockFuture($flags, $file) {
diff --git a/src/filesystem/linesofalarge/LinesOfALarge.php b/src/filesystem/linesofalarge/LinesOfALarge.php
--- a/src/filesystem/linesofalarge/LinesOfALarge.php
+++ b/src/filesystem/linesofalarge/LinesOfALarge.php
@@ -59,7 +59,7 @@
*/
final public function setDelimiter($character) {
if (strlen($character) !== 1) {
- throw new Exception("Delimiter character MUST be one byte in length.");
+ throw new Exception('Delimiter character MUST be one byte in length.');
}
$this->delimiter = $character;
return $this;
diff --git a/src/filesystem/linesofalarge/LinesOfALargeFile.php b/src/filesystem/linesofalarge/LinesOfALargeFile.php
--- a/src/filesystem/linesofalarge/LinesOfALargeFile.php
+++ b/src/filesystem/linesofalarge/LinesOfALargeFile.php
@@ -80,7 +80,7 @@
if (!$this->handle) {
throw new FilesystemException(
$this->fileName,
- "Failed to open file!");
+ 'Failed to open file!');
}
}
@@ -100,7 +100,7 @@
if ($more === false) {
throw new FilesystemException(
$this->fileName,
- "Failed to read file!");
+ 'Failed to read file!');
}
return $more;
}
diff --git a/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php b/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
--- a/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
+++ b/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
@@ -12,14 +12,14 @@
$this->writeAndRead(
"cat\ndog\nbird\n",
array(
- "cat",
- "dog",
- "bird",
+ 'cat',
+ 'dog',
+ 'bird',
));
}
public function testExecLargeFile() {
- $line = "The quick brown fox jumps over the lazy dog.";
+ $line = 'The quick brown fox jumps over the lazy dog.';
$n = 100;
$this->writeAndRead(
@@ -57,7 +57,7 @@
$this->assertEqual(
$read,
$lines,
- "Write: ".phutil_utf8_shorten($write, 32));
+ 'Write: '.phutil_utf8_shorten($write, 32));
}
}
diff --git a/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php b/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php
--- a/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php
+++ b/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php
@@ -7,9 +7,9 @@
public function testBasics() {
$this->writeAndRead(
- "abcd",
+ 'abcd',
array(
- "abcd",
+ 'abcd',
));
}
@@ -17,9 +17,9 @@
$this->writeAndRead(
"bat\ncat\ndog\n",
array(
- "bat",
- "cat",
- "dog",
+ 'bat',
+ 'cat',
+ 'dog',
));
}
@@ -27,9 +27,9 @@
$this->writeAndRead(
"bat\ncat\ndog",
array(
- "bat",
- "cat",
- "dog",
+ 'bat',
+ 'cat',
+ 'dog',
));
}
@@ -37,9 +37,9 @@
$this->writeAndRead(
"bat\1cat\1dog\1",
array(
- "bat",
- "cat",
- "dog",
+ 'bat',
+ 'cat',
+ 'dog',
),
"\1");
}
@@ -55,7 +55,7 @@
}
public function testLargeFile() {
- $line = "The quick brown fox jumps over the lazy dog.";
+ $line = 'The quick brown fox jumps over the lazy dog.';
$n = 100;
$this->writeAndRead(
@@ -83,8 +83,8 @@
public function testLineFilter() {
$write = "bat\ncat\ndog\nBat\nCat\nDog\n";
$read = array(
- 1 => "cat",
- 4 => "Cat",
+ 1 => 'cat',
+ 4 => 'Cat',
);
$tmp = new TempFile();
@@ -101,12 +101,12 @@
$this->assertEqual(
$read,
$lines,
- "Write: ".phutil_utf8_shorten($write, 32));
+ 'Write: '.phutil_utf8_shorten($write, 32));
}
public function allowCatsOnly($line) {
$line = strtoupper($line);
- if ($line != "CAT") {
+ if ($line != 'CAT') {
return null;
}
return $line;
@@ -125,7 +125,7 @@
$this->assertEqual(
$read,
$lines,
- "Write: ".phutil_utf8_shorten($write, 32));
+ 'Write: '.phutil_utf8_shorten($write, 32));
}
}
diff --git a/src/future/FutureProxy.php b/src/future/FutureProxy.php
--- a/src/future/FutureProxy.php
+++ b/src/future/FutureProxy.php
@@ -24,7 +24,7 @@
protected function getProxiedFuture() {
if (!$this->proxied) {
- throw new Exception("The proxied future has not been provided yet.");
+ throw new Exception('The proxied future has not been provided yet.');
}
return $this->proxied;
}
diff --git a/src/future/asana/PhutilAsanaFuture.php b/src/future/asana/PhutilAsanaFuture.php
--- a/src/future/asana/PhutilAsanaFuture.php
+++ b/src/future/asana/PhutilAsanaFuture.php
@@ -36,11 +36,11 @@
$params = $this->params;
if (!$this->action) {
- throw new Exception("You must setRawAsanaQuery()!");
+ throw new Exception('You must setRawAsanaQuery()!');
}
if (!$this->accessToken) {
- throw new Exception("You must setAccessToken()!");
+ throw new Exception('You must setAccessToken()!');
}
$uri = new PhutilURI('https://app.asana.com/');
diff --git a/src/future/aws/PhutilAWSFuture.php b/src/future/aws/PhutilAWSFuture.php
--- a/src/future/aws/PhutilAWSFuture.php
+++ b/src/future/aws/PhutilAWSFuture.php
@@ -57,11 +57,11 @@
$params = $this->params;
if (!$this->params) {
- throw new Exception("You must setRawAWSQuery()!");
+ throw new Exception('You must setRawAWSQuery()!');
}
if (!$this->getAWSAccessKey()) {
- throw new Exception("You must setAWSKeys()!");
+ throw new Exception('You must setAWSKeys()!');
}
$params['AWSAccessKeyId'] = $this->getAWSAccessKey();
diff --git a/src/future/exec/CommandException.php b/src/future/exec/CommandException.php
--- a/src/future/exec/CommandException.php
+++ b/src/future/exec/CommandException.php
@@ -20,15 +20,15 @@
$summary = array();
$summary[] = $this->summarize($message);
- $summary[] = "COMMAND";
+ $summary[] = 'COMMAND';
$summary[] = $this->summarize($command);
$summary[] = null;
- $summary[] = "STDOUT";
+ $summary[] = 'STDOUT';
$summary[] = $this->summarize($stdout);
$summary[] = null;
- $summary[] = "STDERR";
+ $summary[] = 'STDERR';
$summary[] = $this->summarize($stderr);
$summary = implode("\n", $summary);
@@ -62,7 +62,7 @@
$len = strlen($string);
if ($len > $limit) {
$cut = $len - $limit;
- $suffix = "... (".number_format($cut)." more bytes) ...";
+ $suffix = '... ('.number_format($cut).' more bytes) ...';
if ($cut > strlen($suffix)) {
$string = substr($string, 0, $limit).$suffix;
}
diff --git a/src/future/http/BaseHTTPFuture.php b/src/future/http/BaseHTTPFuture.php
--- a/src/future/http/BaseHTTPFuture.php
+++ b/src/future/http/BaseHTTPFuture.php
@@ -156,7 +156,7 @@
*/
public function setData($data) {
if (!is_string($data) && !is_array($data)) {
- throw new Exception("Data parameter must be an array or string.");
+ throw new Exception('Data parameter must be an array or string.');
}
$this->data = $data;
return $this;
diff --git a/src/future/http/HTTPFuture.php b/src/future/http/HTTPFuture.php
--- a/src/future/http/HTTPFuture.php
+++ b/src/future/http/HTTPFuture.php
@@ -66,7 +66,7 @@
if (isset($parts['user']) || isset($parts['pass'])) {
throw new Exception(
- "HTTP Basic Auth is not supported by HTTPFuture.");
+ 'HTTP Basic Auth is not supported by HTTPFuture.');
}
if (isset($parts['path'])) {
@@ -145,7 +145,7 @@
if (strlen($this->writeBuffer)) {
$bytes = @fwrite($this->socket, $this->writeBuffer);
if ($bytes === false) {
- throw new Exception("Failed to write to buffer.");
+ throw new Exception('Failed to write to buffer.');
} else if ($bytes) {
$this->writeBuffer = substr($this->writeBuffer, $bytes);
}
@@ -160,7 +160,7 @@
}
if ($data === false) {
- throw new Exception("Failed to read socket.");
+ throw new Exception('Failed to read socket.');
}
}
@@ -187,7 +187,7 @@
$ok = stream_set_blocking($socket, 0);
if (!$ok) {
- throw new Exception("Failed to set stream nonblocking.");
+ throw new Exception('Failed to set stream nonblocking.');
}
$this->writeBuffer = $this->buildHTTPRequest();
diff --git a/src/future/http/status/HTTPFutureResponseStatusParse.php b/src/future/http/status/HTTPFutureResponseStatusParse.php
--- a/src/future/http/status/HTTPFutureResponseStatusParse.php
+++ b/src/future/http/status/HTTPFutureResponseStatusParse.php
@@ -26,7 +26,7 @@
protected function getErrorCodeDescription($code) {
return
- "The remote host returned something other than an HTTP response: ".
+ 'The remote host returned something other than an HTTP response: '.
$this->rawResponse;
}
diff --git a/src/future/oauth/PhutilOAuth1Future.php b/src/future/oauth/PhutilOAuth1Future.php
--- a/src/future/oauth/PhutilOAuth1Future.php
+++ b/src/future/oauth/PhutilOAuth1Future.php
@@ -126,7 +126,7 @@
foreach ($oauth_headers as $header => $value) {
$full_oauth_header[] = $header.'="'.urlencode($value).'"';
}
- $full_oauth_header = 'OAuth '.implode(", ", $full_oauth_header);
+ $full_oauth_header = 'OAuth '.implode(', ', $full_oauth_header);
$future->addHeader('Authorization', $full_oauth_header);
diff --git a/src/future/paypal/PhutilPayPalAPIFuture.php b/src/future/paypal/PhutilPayPalAPIFuture.php
--- a/src/future/paypal/PhutilPayPalAPIFuture.php
+++ b/src/future/paypal/PhutilPayPalAPIFuture.php
@@ -51,11 +51,11 @@
$params = $this->params;
if (!$this->params) {
- throw new Exception("You must setRawPayPalQuery()!");
+ throw new Exception('You must setRawPayPalQuery()!');
}
if (!$this->apiUsername) {
- throw new Exception("You must set PayPal API credentials!");
+ throw new Exception('You must set PayPal API credentials!');
}
$params['VERSION'] = '98.0';
@@ -82,7 +82,7 @@
if (idx($dict, 'ACK') !== 'Success') {
throw new Exception(
- "PayPal API call failed: ".print_r($dict, true));
+ 'PayPal API call failed: '.print_r($dict, true));
}
return $dict;
diff --git a/src/future/twitch/PhutilTwitchFuture.php b/src/future/twitch/PhutilTwitchFuture.php
--- a/src/future/twitch/PhutilTwitchFuture.php
+++ b/src/future/twitch/PhutilTwitchFuture.php
@@ -42,11 +42,11 @@
$params = $this->params;
if (!$this->action) {
- throw new Exception("You must setRawTwitchQuery()!");
+ throw new Exception('You must setRawTwitchQuery()!');
}
if (!$this->accessToken) {
- throw new Exception("You must setAccessToken()!");
+ throw new Exception('You must setAccessToken()!');
}
$uri = new PhutilURI('https://api.twitch.tv/');
diff --git a/src/future/wordpress/PhutilWordPressFuture.php b/src/future/wordpress/PhutilWordPressFuture.php
--- a/src/future/wordpress/PhutilWordPressFuture.php
+++ b/src/future/wordpress/PhutilWordPressFuture.php
@@ -39,11 +39,11 @@
$params = $this->params;
if (!$this->action) {
- throw new Exception("You must setRawWordPressQuery()!");
+ throw new Exception('You must setRawWordPressQuery()!');
}
if (!$this->accessToken) {
- throw new Exception("You must setAccessToken()!");
+ throw new Exception('You must setAccessToken()!');
}
$uri = new PhutilURI('https://public-api.wordpress.com/');
diff --git a/src/grammar/PhutilContextFreeGrammar.php b/src/grammar/PhutilContextFreeGrammar.php
--- a/src/grammar/PhutilContextFreeGrammar.php
+++ b/src/grammar/PhutilContextFreeGrammar.php
@@ -9,7 +9,7 @@
abstract protected function getRules();
- public function generateSeveral($count, $implode = " ") {
+ public function generateSeveral($count, $implode = ' ') {
$paragraph = array();
for ($ii = 0; $ii < $count; $ii++) {
$paragraph[$ii] = $this->generate();
@@ -25,7 +25,7 @@
final protected function applyRules($input, &$count, array $rules) {
if (++$count > $this->limit) {
- throw new Exception("Token replacement count exceeded limit!");
+ throw new Exception('Token replacement count exceeded limit!');
}
$matches = null;
@@ -84,10 +84,10 @@
private static function strPadLines($text, $num_spaces = 2) {
$text_lines = phutil_split_lines($text);
foreach ($text_lines as $linenr => $line) {
- $text_lines[$linenr] = str_repeat(" ", $num_spaces) . $line;
+ $text_lines[$linenr] = str_repeat(' ', $num_spaces) . $line;
}
- return implode("", $text_lines);
+ return implode('', $text_lines);
}
}
diff --git a/src/grammar/code/PhutilCLikeCodeSnippetContextFreeGrammar.php b/src/grammar/code/PhutilCLikeCodeSnippetContextFreeGrammar.php
--- a/src/grammar/code/PhutilCLikeCodeSnippetContextFreeGrammar.php
+++ b/src/grammar/code/PhutilCLikeCodeSnippetContextFreeGrammar.php
@@ -48,7 +48,7 @@
protected function getFuncCallGrammarSet() {
return $this->buildGrammarSet('funccall',
array(
- "[funcname]([funccallparam])",
+ '[funcname]([funccallparam])',
));
}
@@ -101,8 +101,8 @@
protected function getClassDeclGrammarSet() {
return $this->buildGrammarSet('classdecl',
array(
- "[classinheritancemod] class [classname] {[classbody, indent, block]}",
- "class [classname] {[classbody, indent, block]}",
+ '[classinheritancemod] class [classname] {[classbody, indent, block]}',
+ 'class [classname] {[classbody, indent, block]}',
));
}
@@ -132,7 +132,7 @@
protected function getClassBodyGrammarSet() {
return $this->buildGrammarSet('classbody',
array(
- "[methoddecl]",
+ '[methoddecl]',
"[methoddecl]\n\n[methoddecl]",
"[propdecl]\n[propdecl]\n\n[methoddecl]\n\n[methoddecl]",
"[propdecl]\n[propdecl]\n[propdecl]\n\n[methoddecl]\n\n[methoddecl]".
diff --git a/src/internationalization/__tests__/PhutilTranslatorTestCase.php b/src/internationalization/__tests__/PhutilTranslatorTestCase.php
--- a/src/internationalization/__tests__/PhutilTranslatorTestCase.php
+++ b/src/internationalization/__tests__/PhutilTranslatorTestCase.php
@@ -198,7 +198,7 @@
$translator = new PhutilTranslator();
foreach ($tests as $original => $translations) {
foreach ($translations as $translation => $expect) {
- $valid = ($expect ? "valid" : "invalid");
+ $valid = ($expect ? 'valid' : 'invalid');
$this->assertEqual(
$expect,
$translator->validateTranslation($original, $translation),
diff --git a/src/lexer/PhutilPHPFragmentLexer.php b/src/lexer/PhutilPHPFragmentLexer.php
--- a/src/lexer/PhutilPHPFragmentLexer.php
+++ b/src/lexer/PhutilPHPFragmentLexer.php
@@ -155,8 +155,8 @@
array('0[xX][a-fA-F0-9]+', 'mh'),
array('0[bB][0-1]+', 'm'),
array('\d+', 'mi'),
- array("'", "s1", 'string1'),
- array("`", "sb", 'stringb'),
+ array("'", 's1', 'string1'),
+ array('`', 'sb', 'stringb'),
array('"', 's2', 'string2'),
array('.', null),
)),
diff --git a/src/lexer/PhutilShellLexer.php b/src/lexer/PhutilShellLexer.php
--- a/src/lexer/PhutilShellLexer.php
+++ b/src/lexer/PhutilShellLexer.php
@@ -30,7 +30,7 @@
$tokens = $this->getTokens($string);
if (count($this->getLexerState()) > 1) {
throw new UnexpectedValueException(
- "Unterminated string in argument list!");
+ 'Unterminated string in argument list!');
}
foreach ($tokens as $key => $token) {
diff --git a/src/markup/__tests__/PhutilSafeHTMLTestCase.php b/src/markup/__tests__/PhutilSafeHTMLTestCase.php
--- a/src/markup/__tests__/PhutilSafeHTMLTestCase.php
+++ b/src/markup/__tests__/PhutilSafeHTMLTestCase.php
@@ -7,7 +7,7 @@
public function testOperator() {
if (!extension_loaded('operator')) {
- $this->assertSkipped("Operator extension not available.");
+ $this->assertSkipped('Operator extension not available.');
}
$a = phutil_tag('a');
diff --git a/src/markup/engine/PhutilRemarkupEngine.php b/src/markup/engine/PhutilRemarkupEngine.php
--- a/src/markup/engine/PhutilRemarkupEngine.php
+++ b/src/markup/engine/PhutilRemarkupEngine.php
@@ -165,9 +165,9 @@
if ($prev_block
&& self::shouldMergeBlocks($text, $prev_block, $curr_block)) {
- $blocks[last_key($blocks)]["num_lines"] += $curr_block["num_lines"];
- $blocks[last_key($blocks)]["is_empty"] =
- $blocks[last_key($blocks)]["is_empty"] && $curr_block["is_empty"];
+ $blocks[last_key($blocks)]['num_lines'] += $curr_block['num_lines'];
+ $blocks[last_key($blocks)]['is_empty'] =
+ $blocks[last_key($blocks)]['is_empty'] && $curr_block['is_empty'];
} else {
$blocks[] = $curr_block;
}
@@ -178,7 +178,7 @@
}
if ($starting_cursor === $cursor) {
- throw new Exception("Block in text did not match any block rule.");
+ throw new Exception('Block in text did not match any block rule.');
}
}
@@ -237,9 +237,9 @@
}
private static function shouldMergeBlocks($text, $prev_block, $curr_block) {
- $block_rules = ipull(array($prev_block, $curr_block), "rule");
+ $block_rules = ipull(array($prev_block, $curr_block), 'rule');
- $default_rule = "PhutilRemarkupEngineRemarkupDefaultBlockRule";
+ $default_rule = 'PhutilRemarkupEngineRemarkupDefaultBlockRule';
try {
assert_instances_of($block_rules, $default_rule);
@@ -254,8 +254,8 @@
}
// If the current line and the last line have content, keep merging
- if (strlen(trim($text[$curr_block["start"] - 1]))) {
- if (strlen(trim($text[$curr_block["start"]]))) {
+ if (strlen(trim($text[$curr_block['start'] - 1]))) {
+ if (strlen(trim($text[$curr_block['start']]))) {
return true;
}
}
diff --git a/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php b/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
--- a/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
+++ b/src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
@@ -33,9 +33,9 @@
// test, "~" is used as a placeholder for "\1" since it's hard to type
// "\1".
- $input_remarkup = str_replace("~", "\1", $input_remarkup);
- $expected_output = str_replace("~", "\1", $expected_output);
- $expected_text = str_replace("~", "\1", $expected_text);
+ $input_remarkup = str_replace('~', "\1", $input_remarkup);
+ $expected_output = str_replace('~', "\1", $expected_output);
+ $expected_text = str_replace('~', "\1", $expected_text);
break;
case 'toc.txt':
$engine->setConfig('header.generate-toc', true);
diff --git a/src/markup/engine/remarkup/PhutilRemarkupBlockStorage.php b/src/markup/engine/remarkup/PhutilRemarkupBlockStorage.php
--- a/src/markup/engine/remarkup/PhutilRemarkupBlockStorage.php
+++ b/src/markup/engine/remarkup/PhutilRemarkupBlockStorage.php
@@ -40,7 +40,7 @@
private $index;
public function store($text) {
- $key = self::MAGIC_BYTE.(++$this->index)."Z";
+ $key = self::MAGIC_BYTE.(++$this->index).'Z';
$this->map[$key] = $text;
return $key;
}
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupCodeBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupCodeBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupCodeBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupCodeBlockRule.php
@@ -9,9 +9,9 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
$match_ticks = null;
- if (preg_match("/^(\s{2,}).+/", $lines[$cursor])) {
+ if (preg_match('/^(\s{2,}).+/', $lines[$cursor])) {
$match_ticks = false;
- } else if (preg_match("/^(```)/", $lines[$cursor])) {
+ } else if (preg_match('/^(```)/', $lines[$cursor])) {
$match_ticks = true;
} else {
return $num_lines;
@@ -19,7 +19,7 @@
$num_lines++;
- if ($match_ticks && preg_match("/^(```)(.*)(```)\s*$/", $lines[$cursor])) {
+ if ($match_ticks && preg_match('/^(```)(.*)(```)\s*$/', $lines[$cursor])) {
return $num_lines;
}
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule.php
@@ -16,7 +16,7 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
- $pattern = "/^_{3,}$|^\*\s?\*\s?\*(\s|\*)*$|^\-\s?\-\s?\-(\s|\-)*$/";
+ $pattern = '/^_{3,}$|^\*\s?\*\s?\*(\s|\*)*$|^\-\s?\-\s?\-(\s|\-)*$/';
if (preg_match($pattern, rtrim($lines[$cursor], "\n\r"))) {
$num_lines++;
$cursor++;
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupInterpreterRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupInterpreterRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupInterpreterRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupInterpreterRule.php
@@ -55,11 +55,11 @@
$lines[$first_key] = preg_replace(
self::START_BLOCK_PATTERN,
- "",
+ '',
$lines[$first_key]);
$lines[$last_key] = preg_replace(
self::END_BLOCK_PATTERN,
- "",
+ '',
$lines[$last_key]);
if (trim($lines[$first_key]) === '') {
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupLiteralBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupLiteralBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupLiteralBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupLiteralBlockRule.php
@@ -8,11 +8,11 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
- if (preg_match("/^%%%/", $lines[$cursor])) {
+ if (preg_match('/^%%%/', $lines[$cursor])) {
$num_lines++;
while (isset($lines[$cursor])) {
- if (!preg_match("/%%%\s*$/", $lines[$cursor])) {
+ if (!preg_match('/%%%\s*$/', $lines[$cursor])) {
$num_lines++;
$cursor++;
continue;
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTableBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTableBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTableBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTableBlockRule.php
@@ -50,7 +50,7 @@
$row_regex = '@'.$row_fragment.'@Usi';
if (!preg_match_all($row_regex, $body, $matches, PREG_SET_ORDER)) {
throw new Exception(
- "Bug in Remarkup tables, parsing fails for input: ".$text);
+ 'Bug in Remarkup tables, parsing fails for input: '.$text);
}
$out_rows = array();
@@ -70,7 +70,7 @@
$cell_regex = '@'.$cell_fragment.'@Usi';
if (!preg_match_all($cell_regex, $content, $matches, PREG_SET_ORDER)) {
throw new Exception(
- "Bug in Remarkup tables, parsing fails for input: ".$text);
+ 'Bug in Remarkup tables, parsing fails for input: '.$text);
}
$out_cells = array();
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTestInterpreterRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTestInterpreterRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTestInterpreterRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupTestInterpreterRule.php
@@ -7,7 +7,7 @@
extends PhutilRemarkupBlockInterpreter {
public function getInterpreterName() {
- return "phutil_test_block_interpreter";
+ return 'phutil_test_block_interpreter';
}
public function markupContent($content, array $argv) {
diff --git a/src/markup/syntax/highlighter/PhutilInvisibleSyntaxHighlighter.php b/src/markup/syntax/highlighter/PhutilInvisibleSyntaxHighlighter.php
--- a/src/markup/syntax/highlighter/PhutilInvisibleSyntaxHighlighter.php
+++ b/src/markup/syntax/highlighter/PhutilInvisibleSyntaxHighlighter.php
@@ -13,9 +13,9 @@
}
public function getHighlightFuture($source) {
- $keys = array_map("chr", range(0x0, 0x1F));
+ $keys = array_map('chr', range(0x0, 0x1F));
$vals = array_map(
- array($this, "decimalToHtmlEntityDecoded"), range(0x2400, 0x241F));
+ array($this, 'decimalToHtmlEntityDecoded'), range(0x2400, 0x241F));
$invisible = array_combine($keys, $vals);
@@ -24,7 +24,7 @@
if (isset($invisible[$character])) {
$result[] = phutil_tag(
'span',
- array("class" => "invisible"),
+ array('class' => 'invisible'),
$invisible[$character]);
if ($character === "\n") {
diff --git a/src/parser/PhutilParserGenerator.php b/src/parser/PhutilParserGenerator.php
--- a/src/parser/PhutilParserGenerator.php
+++ b/src/parser/PhutilParserGenerator.php
@@ -118,28 +118,28 @@
public function getEOFSymbol() {
if ($this->eofSymbol === null) {
- throw new Exception("Call processGrammar() before getEOFSymbol()!");
+ throw new Exception('Call processGrammar() before getEOFSymbol()!');
}
return $this->eofSymbol;
}
public function getInitSymbol() {
if ($this->initSymbol === null) {
- throw new Exception("Call processGrammar() before getInitSymbol()!");
+ throw new Exception('Call processGrammar() before getInitSymbol()!');
}
return $this->initSymbol;
}
public function getEpsilonSymbol() {
if ($this->epsilonSymbol === null) {
- throw new Exception("Call processGrammar() before getEpsilonSymbol()!");
+ throw new Exception('Call processGrammar() before getEpsilonSymbol()!');
}
return $this->epsilonSymbol;
}
public function getEndSymbol() {
if ($this->endSymbol === null) {
- throw new Exception("Call processGrammar() before getEndSymbol()!");
+ throw new Exception('Call processGrammar() before getEndSymbol()!');
}
return $this->endSymbol;
}
@@ -319,7 +319,7 @@
$missing_terminals = array_keys($missing);
$missing_terminals = implode(', ', $missing_terminals);
throw new PhutilParserGeneratorUnreachableTerminalException(
- "Some terminals do not appear in any rule: ".
+ 'Some terminals do not appear in any rule: '.
$missing_terminals);
}
}
@@ -339,7 +339,7 @@
$missing_rules = array_keys($missing);
$missing_rules = implode(', ', $missing_rules);
throw new PhutilParserGeneratorUnreachableRuleException(
- "Some rules can never be reached from any production: ".
+ 'Some rules can never be reached from any production: '.
$missing_rules);
}
}
@@ -731,11 +731,11 @@
}
if ($accept && isset($shift[$eof])) {
- throw new Exception("Accept/shift conflict!");
+ throw new Exception('Accept/shift conflict!');
}
if ($accept && isset($reduce[$eof])) {
- throw new Exception("Accept/reduce conflict!");
+ throw new Exception('Accept/reduce conflict!');
}
foreach ($reduce as $next => $item) {
@@ -860,7 +860,7 @@
*/
public function inspectRules() {
if (!$this->rulesValidated) {
- throw new Exception("Call processGrammar() before inspectRules()!");
+ throw new Exception('Call processGrammar() before inspectRules()!');
}
return $this->rules;
}
@@ -871,7 +871,7 @@
*/
public function inspectFirstTable() {
if ($this->firstTable === null) {
- throw new Exception("Call processGrammar() before inspectFirstTable()!");
+ throw new Exception('Call processGrammar() before inspectFirstTable()!');
}
return $this->firstTable;
}
diff --git a/src/parser/PhutilQueryStringParser.php b/src/parser/PhutilQueryStringParser.php
--- a/src/parser/PhutilQueryStringParser.php
+++ b/src/parser/PhutilQueryStringParser.php
@@ -114,7 +114,7 @@
*/
private function parseQueryKeyToArr($key, $val, array &$input_arr) {
if (preg_match('/^[^\[\]]+(?:\[[^\[\]]*\])+$/', $key)) {
- $key_pieces = preg_split('/\]?\[/', rtrim($key, "]"));
+ $key_pieces = preg_split('/\]?\[/', rtrim($key, ']'));
if ($key_pieces) {
$cursor = &$input_arr;
foreach ($key_pieces as $piece) {
diff --git a/src/parser/PhutilSimpleOptions.php b/src/parser/PhutilSimpleOptions.php
--- a/src/parser/PhutilSimpleOptions.php
+++ b/src/parser/PhutilSimpleOptions.php
@@ -177,7 +177,7 @@
private function normalizeKey($key) {
if (!strlen($key)) {
- throw new Exception("Empty key is invalid!");
+ throw new Exception('Empty key is invalid!');
}
if (!$this->caseSensitive) {
$key = strtolower($key);
diff --git a/src/parser/__tests__/PhutilDocblockParserTestCase.php b/src/parser/__tests__/PhutilDocblockParserTestCase.php
--- a/src/parser/__tests__/PhutilDocblockParserTestCase.php
+++ b/src/parser/__tests__/PhutilDocblockParserTestCase.php
@@ -32,23 +32,23 @@
case 'indented-block.docblock':
$this->assertEqual(array(), $specials);
$this->assertEqual(
- "Cozy lummox gives smart squid who asks for job pen.",
+ 'Cozy lummox gives smart squid who asks for job pen.',
$docblock);
break;
case 'indented-text.docblock':
$this->assertEqual(array(), $specials);
$this->assertEqual(
- "Cozy lummox gives smart squid who asks for job pen.",
+ 'Cozy lummox gives smart squid who asks for job pen.',
$docblock);
break;
case 'multiline-special.docblock':
$this->assertEqual(
array(
- 'special' => "x y z",
+ 'special' => 'x y z',
),
$specials);
$this->assertEqual(
- "",
+ '',
$docblock);
break;
case 'multi-specials.docblock':
@@ -58,7 +58,7 @@
),
$specials);
$this->assertEqual(
- "",
+ '',
$docblock);
break;
case 'specials.docblock':
@@ -69,7 +69,7 @@
),
$specials);
$this->assertEqual(
- "",
+ '',
$docblock);
break;
case 'linebreak-breaks-specials.docblock':
@@ -79,15 +79,15 @@
),
$specials);
$this->assertEqual(
- "This is normal text, not part of the @title.",
+ 'This is normal text, not part of the @title.',
$docblock);
break;
case 'specials-with-hyphen.docblock':
$this->assertEqual(
array(
'repeat-hyphen' => "a\nb",
- 'multiline-hyphen' => "mmm nnn",
- 'normal-hyphen' => "x",
+ 'multiline-hyphen' => 'mmm nnn',
+ 'normal-hyphen' => 'x',
),
$specials);
break;
diff --git a/src/parser/__tests__/PhutilParserGeneratorTestCase.php b/src/parser/__tests__/PhutilParserGeneratorTestCase.php
--- a/src/parser/__tests__/PhutilParserGeneratorTestCase.php
+++ b/src/parser/__tests__/PhutilParserGeneratorTestCase.php
@@ -275,7 +275,7 @@
break;
}
- throw new Exception("Unexpected rule in ET grammar.");
+ throw new Exception('Unexpected rule in ET grammar.');
}
private function buildABCGenerator() {
diff --git a/src/parser/__tests__/PhutilQueryStringParserTestCase.php b/src/parser/__tests__/PhutilQueryStringParserTestCase.php
--- a/src/parser/__tests__/PhutilQueryStringParserTestCase.php
+++ b/src/parser/__tests__/PhutilQueryStringParserTestCase.php
@@ -9,47 +9,47 @@
public function testQueryStringParsing() {
$map = array(
- "" => array(),
- "foo=bar&foobar=barfoo" => array(
- "foo" => "bar",
- "foobar" => "barfoo",
- ),
- "a]b[]=1&a]=2&a[[]=3&a[b]b=4&[][a]=5" => array(
- "a]b[]" => "1",
- "a]" => "2",
- "a[[]" => "3",
- "a[b]b" => "4",
- "[][a]" => "5",
- ),
- "foo[][]=bar&bar[1][3]=foo" => array(
- "foo" => array(
+ '' => array(),
+ 'foo=bar&foobar=barfoo' => array(
+ 'foo' => 'bar',
+ 'foobar' => 'barfoo',
+ ),
+ 'a]b[]=1&a]=2&a[[]=3&a[b]b=4&[][a]=5' => array(
+ 'a]b[]' => '1',
+ 'a]' => '2',
+ 'a[[]' => '3',
+ 'a[b]b' => '4',
+ '[][a]' => '5',
+ ),
+ 'foo[][]=bar&bar[1][3]=foo' => array(
+ 'foo' => array(
0 => array(
- 0 => "bar",
+ 0 => 'bar',
),
),
- "bar" => array(
+ 'bar' => array(
1 => array(
- 3 => "foo",
+ 3 => 'foo',
),
),
),
- "foo[][]=bar&a]b[]=1" => array(
- "foo" => array(
+ 'foo[][]=bar&a]b[]=1' => array(
+ 'foo' => array(
0 => array(
- 0 => "bar",
+ 0 => 'bar',
),
),
- "a]b[]" => "1",
+ 'a]b[]' => '1',
),
- "a&&b" => array(
- "a" => "",
- "b" => "",
+ 'a&&b' => array(
+ 'a' => '',
+ 'b' => '',
),
- "a[b][]=foo&a[b][]=bar" => array(
- "a" => array(
- "b" => array(
- 0 => "foo",
- 1 => "bar",
+ 'a[b][]=foo&a[b][]=bar' => array(
+ 'a' => array(
+ 'b' => array(
+ 0 => 'foo',
+ 1 => 'bar',
),
),
),
diff --git a/src/parser/__tests__/PhutilSimpleOptionsTestCase.php b/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
--- a/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
+++ b/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
@@ -115,7 +115,7 @@
$this->assertEqual(
$expect,
$parser->unparse($dict),
- "Correct unparse of ".print_r($dict, true));
+ 'Correct unparse of '.print_r($dict, true));
}
$bogus = array(
@@ -133,14 +133,14 @@
}
$this->assertTrue(
$caught instanceof Exception,
- "Correct throw on unparse of bad input.");
+ 'Correct throw on unparse of bad input.');
}
$parser = new PhutilSimpleOptions();
$this->assertEqual(
'a="\\}"',
$parser->unparse(array('a' => '}'), '}'),
- "Unparse with extra escape.");
+ 'Unparse with extra escape.');
}
}
diff --git a/src/parser/__tests__/PhutilTypeSpecTestCase.php b/src/parser/__tests__/PhutilTypeSpecTestCase.php
--- a/src/parser/__tests__/PhutilTypeSpecTestCase.php
+++ b/src/parser/__tests__/PhutilTypeSpecTestCase.php
@@ -121,21 +121,21 @@
public function testGetTypeOf() {
$map = array(
'int' => 1,
- 'string' => "asdf",
+ 'string' => 'asdf',
'float' => 1.5,
'bool' => true,
'null' => null,
'map<wild, wild>' => array(),
- 'list<string>' => array("a", "b"),
+ 'list<string>' => array('a', 'b'),
'list<int>' => array(1, 2, 3),
- 'map<string, int>' => array("x" => 3),
- 'map<int, list<string>>' => array(1 => array("x", "y")),
+ 'map<string, int>' => array('x' => 3),
+ 'map<int, list<string>>' => array(1 => array('x', 'y')),
'stdClass' => new stdClass(),
'list<Exception>' => array(
new Exception(),
new LogicException(),
new RuntimeException()),
- 'map<string, stdClass>' => array("x" => new stdClass()),
+ 'map<string, stdClass>' => array('x' => new stdClass()),
);
foreach ($map as $expect => $input) {
diff --git a/src/parser/aast/api/AASTNodeList.php b/src/parser/aast/api/AASTNodeList.php
--- a/src/parser/aast/api/AASTNodeList.php
+++ b/src/parser/aast/api/AASTNodeList.php
@@ -61,9 +61,9 @@
}
$desc = array();
- $desc[] = "a list of ".count($this->list)." nodes:";
+ $desc[] = 'a list of '.count($this->list).' nodes:';
foreach ($this->list as $node) {
- $desc[] = ' '.$node->getDescription().";";
+ $desc[] = ' '.$node->getDescription().';';
}
return implode("\n", $desc);
diff --git a/src/parser/argument/PhutilArgumentParser.php b/src/parser/argument/PhutilArgumentParser.php
--- a/src/parser/argument/PhutilArgumentParser.php
+++ b/src/parser/argument/PhutilArgumentParser.php
@@ -324,7 +324,7 @@
if ($name === null) {
throw new PhutilArgumentSpecificationException(
- "Workflow has no name!");
+ 'Workflow has no name!');
}
if (isset($this->workflows[$name])) {
@@ -342,7 +342,7 @@
$argv = array('help');
} else {
throw new PhutilArgumentUsageException(
- "No workflow selected.");
+ 'No workflow selected.');
}
}
@@ -358,7 +358,7 @@
$command_list = implode(', ', $workflow_names);
$ex_msg =
"Invalid command '{$flow}'. Valid commands are: {$command_list}.";
- if (in_array("help", $workflow_names)) {
+ if (in_array('help', $workflow_names)) {
$bin = basename($this->bin);
$ex_msg .=
"\nFor more details on available commands, run `{$bin} help`.";
@@ -582,7 +582,7 @@
$show_details = false);
}
if ($has_help) {
- $more[] = "Use **help** __command__ for a detailed command reference.";
+ $more[] = 'Use **help** __command__ for a detailed command reference.';
}
}
@@ -597,7 +597,7 @@
// a quick hint about it.
if (!empty($this->specs['show-standard-options']) &&
!$this->getArg('show-standard-options')) {
- $more[] = "Use __--show-standard-options__ to show additional options.";
+ $more[] = 'Use __--show-standard-options__ to show additional options.';
}
$out[] = null;
@@ -706,8 +706,8 @@
if ($spec->getWildcard()) {
if ($wildcard) {
throw new PhutilArgumentSpecificationException(
- "Two argument specifications are marked as wildcard arguments. ".
- "You can have a maximum of one wildcard argument.");
+ 'Two argument specifications are marked as wildcard arguments. '.
+ 'You can have a maximum of one wildcard argument.');
} else {
$wildcard = $spec;
}
diff --git a/src/parser/argument/PhutilArgumentSpecification.php b/src/parser/argument/PhutilArgumentSpecification.php
--- a/src/parser/argument/PhutilArgumentSpecification.php
+++ b/src/parser/argument/PhutilArgumentSpecification.php
@@ -237,23 +237,23 @@
if ($this->getWildcard()) {
if ($this->getParamName()) {
throw new PhutilArgumentSpecificationException(
- "Wildcard arguments may not specify a parameter.");
+ 'Wildcard arguments may not specify a parameter.');
}
if ($this->getRepeatable()) {
throw new PhutilArgumentSpecificationException(
- "Wildcard arguments may not be repeatable.");
+ 'Wildcard arguments may not be repeatable.');
}
}
if ($this->default !== null) {
if ($this->getRepeatable()) {
throw new PhutilArgumentSpecificationException(
- "Repeatable arguments may not have a default (always array() for ".
- "arguments which accept a parameter, or 0 for arguments which do ".
- "not).");
+ 'Repeatable arguments may not have a default (always array() for '.
+ 'arguments which accept a parameter, or 0 for arguments which do '.
+ 'not).');
} else if ($this->getParamName() === null) {
throw new PhutilArgumentSpecificationException(
- "Flag arguments may not have a default (always false).");
+ 'Flag arguments may not have a default (always false).');
}
}
}
diff --git a/src/parser/argument/__tests__/PhutilArgumentSpecificationTestCase.php b/src/parser/argument/__tests__/PhutilArgumentSpecificationTestCase.php
--- a/src/parser/argument/__tests__/PhutilArgumentSpecificationTestCase.php
+++ b/src/parser/argument/__tests__/PhutilArgumentSpecificationTestCase.php
@@ -137,7 +137,7 @@
$this->assertEqual(
!$expect,
$caught instanceof Exception,
- "Spec validity for: ".print_r($spec, true));
+ 'Spec validity for: '.print_r($spec, true));
}
}
}
diff --git a/src/parser/argument/workflow/PhutilArgumentWorkflow.php b/src/parser/argument/workflow/PhutilArgumentWorkflow.php
--- a/src/parser/argument/workflow/PhutilArgumentWorkflow.php
+++ b/src/parser/argument/workflow/PhutilArgumentWorkflow.php
@@ -112,7 +112,7 @@
final public function getExamples() {
if (!$this->examples) {
- return "**".$this->name."**";
+ return '**'.$this->name.'**';
}
return $this->examples;
}
diff --git a/src/parser/exception/PhutilTypeCheckException.php b/src/parser/exception/PhutilTypeCheckException.php
--- a/src/parser/exception/PhutilTypeCheckException.php
+++ b/src/parser/exception/PhutilTypeCheckException.php
@@ -13,7 +13,7 @@
"Parameter '%s' has invalid type.",
$name);
} else {
- $invalid = pht("Parameter has invalid type.");
+ $invalid = pht('Parameter has invalid type.');
}
if ($type->getType() == 'regex') {
@@ -24,7 +24,7 @@
$err);
} else {
$message = pht(
- "Expected a regular expression, but value is not valid: %s",
+ 'Expected a regular expression, but value is not valid: %s',
$err);
}
} else {
diff --git a/src/parser/xhpast/api/XHPASTNode.php b/src/parser/xhpast/api/XHPASTNode.php
--- a/src/parser/xhpast/api/XHPASTNode.php
+++ b/src/parser/xhpast/api/XHPASTNode.php
@@ -72,7 +72,7 @@
return $operand->evalStatic();
break;
default:
- throw new Exception("Unexpected operator in static expression.");
+ throw new Exception('Unexpected operator in static expression.');
}
break;
case 'n_ARRAY_LITERAL':
diff --git a/src/parser/xhpast/api/XHPASTTree.php b/src/parser/xhpast/api/XHPASTTree.php
--- a/src/parser/xhpast/api/XHPASTTree.php
+++ b/src/parser/xhpast/api/XHPASTTree.php
@@ -38,7 +38,7 @@
$tree = XHPASTTree::newFromData($string);
$statements = $tree->getRootNode()->selectDescendantsOfType('n_STATEMENT');
if (count($statements) != 1) {
- throw new Exception("String does not parse into exactly one statement!");
+ throw new Exception('String does not parse into exactly one statement!');
}
// Return the first one, trying to use reset() with iterators ends in tears.
foreach ($statements as $statement) {
@@ -67,7 +67,7 @@
$data = json_decode($stdout, true);
if (!is_array($data)) {
- throw new Exception("XHPAST: failed to decode tree.");
+ throw new Exception('XHPAST: failed to decode tree.');
}
return new XHPASTTree($data['tree'], $data['stream'], $php_source);
diff --git a/src/parser/xhpast/bin/xhpast_parse.php b/src/parser/xhpast/bin/xhpast_parse.php
--- a/src/parser/xhpast/bin/xhpast_parse.php
+++ b/src/parser/xhpast/bin/xhpast_parse.php
@@ -12,7 +12,7 @@
list($err, $stdout) = exec_manual('%s --version', $bin);
if (!$err) {
$version = trim($stdout);
- if ($version === "xhpast version 5.5.8/1e") {
+ if ($version === 'xhpast version 5.5.8/1e') {
$available = true;
}
}
diff --git a/src/phage/agent/PhagePHPAgent.php b/src/phage/agent/PhagePHPAgent.php
--- a/src/phage/agent/PhagePHPAgent.php
+++ b/src/phage/agent/PhagePHPAgent.php
@@ -48,7 +48,7 @@
$open = $channel->update();
if (!$open) {
- throw new Exception("Channel closed!");
+ throw new Exception('Channel closed!');
}
while (true) {
diff --git a/src/phage/bootloader/PhagePHPAgentBootloader.php b/src/phage/bootloader/PhagePHPAgentBootloader.php
--- a/src/phage/bootloader/PhagePHPAgentBootloader.php
+++ b/src/phage/bootloader/PhagePHPAgentBootloader.php
@@ -82,7 +82,7 @@
$boot_sequence->addText($main_sequence->toString());
if (strlen($boot_length) > 8192) {
- throw new Exception("Stage 1 bootloader is too large!");
+ throw new Exception('Stage 1 bootloader is too large!');
}
$this->bootSequence = $boot_sequence;
diff --git a/src/utils/AbstractDirectedGraph.php b/src/utils/AbstractDirectedGraph.php
--- a/src/utils/AbstractDirectedGraph.php
+++ b/src/utils/AbstractDirectedGraph.php
@@ -75,8 +75,8 @@
final public function addNodes(array $nodes) {
if ($this->graphLoaded) {
throw new Exception(
- "Call addNodes() before calling loadGraph(). You can not add more ".
- "nodes once you have loaded the graph.");
+ 'Call addNodes() before calling loadGraph(). You can not add more '.
+ 'nodes once you have loaded the graph.');
}
$this->knownNodes += $nodes;
@@ -172,8 +172,8 @@
foreach ($load as $node) {
if (!isset($new_nodes[$node]) || !is_array($new_nodes[$node])) {
throw new Exception(
- "loadEdges() must return an edge list array for each provided ".
- "node, or the cycle detection algorithm may not terminate.");
+ 'loadEdges() must return an edge list array for each provided '.
+ 'node, or the cycle detection algorithm may not terminate.');
}
}
@@ -216,8 +216,8 @@
final public function detectCycles($node) {
if (!$this->graphLoaded) {
throw new Exception(
- "Call loadGraph() to build the graph out before calling ".
- "detectCycles().");
+ 'Call loadGraph() to build the graph out before calling '.
+ 'detectCycles().');
}
if (!isset($this->knownNodes[$node])) {
throw new Exception(
diff --git a/src/utils/PhutilDirectedScalarGraph.php b/src/utils/PhutilDirectedScalarGraph.php
--- a/src/utils/PhutilDirectedScalarGraph.php
+++ b/src/utils/PhutilDirectedScalarGraph.php
@@ -8,8 +8,8 @@
protected function loadEdges(array $nodes) {
throw new Exception(
- "PhutilDirectedScalarGraph can not load additional nodes at runtime. ".
- "Tried to load: ".implode(', ', $nodes));
+ 'PhutilDirectedScalarGraph can not load additional nodes at runtime. '.
+ 'Tried to load: '.implode(', ', $nodes));
}
}
diff --git a/src/utils/PhutilEditDistanceMatrix.php b/src/utils/PhutilEditDistanceMatrix.php
--- a/src/utils/PhutilEditDistanceMatrix.php
+++ b/src/utils/PhutilEditDistanceMatrix.php
@@ -166,7 +166,7 @@
private function requireSequences() {
if ($this->x === null) {
throw new Exception(
- "Call setSequences() before performing useful work!");
+ 'Call setSequences() before performing useful work!');
}
}
@@ -293,7 +293,7 @@
private function getTypeMatrix() {
if (!$this->computeString) {
throw new Exception(
- "Call setComputeString() before getTypeMatrix().");
+ 'Call setComputeString() before getTypeMatrix().');
}
if ($this->typeMatrix === null) {
$this->computeMatrix($this->x, $this->y);
@@ -366,8 +366,8 @@
$alt_cost = $this->getAlterCost();
if ($alt_cost && !$use_types) {
throw new Exception(
- "If you provide an alter cost with setAlterCost(), you must enable ".
- "type computation with setComputeStrings().");
+ 'If you provide an alter cost with setAlterCost(), you must enable '.
+ 'type computation with setComputeStrings().');
}
// Build the edit distance matrix.
diff --git a/src/utils/__tests__/PhutilEditDistanceMatrixTestCase.php b/src/utils/__tests__/PhutilEditDistanceMatrixTestCase.php
--- a/src/utils/__tests__/PhutilEditDistanceMatrixTestCase.php
+++ b/src/utils/__tests__/PhutilEditDistanceMatrixTestCase.php
@@ -43,9 +43,9 @@
// Misc.
$this->assertDistance(
13,
- "The quick brown fox jumped over the lazy dog!",
+ 'The quick brown fox jumped over the lazy dog!',
// dddddd r ii i iii
- "The brown fox pumped over those lazy dogs!~~~");
+ 'The brown fox pumped over those lazy dogs!~~~');
}
public function testDamerauEditDistance() {
diff --git a/src/utils/__tests__/PhutilUTF8TestCase.php b/src/utils/__tests__/PhutilUTF8TestCase.php
--- a/src/utils/__tests__/PhutilUTF8TestCase.php
+++ b/src/utils/__tests__/PhutilUTF8TestCase.php
@@ -50,7 +50,7 @@
'x' => 1,
"\xEF\xBF\xBD" => 1,
"x\xe6\x9d\xb1y" => 3,
- "xyz" => 3,
+ 'xyz' => 3,
'quack' => 5,
);
foreach ($strings as $str => $expect) {
@@ -66,7 +66,7 @@
"x\xe6\x9d\xb1y" => array('x', "\xe6\x9d\xb1", 'y'),
// This is a combining character.
- "x\xCD\xA0y" => array("x", "\xCD\xA0", 'y'),
+ "x\xCD\xA0y" => array('x', "\xCD\xA0", 'y'),
);
foreach ($strings as $str => $expect) {
$this->assertEqual($expect, phutil_utf8v($str), 'Vector of '.$str);
@@ -98,9 +98,9 @@
public function testUTF8ConsoleStrlen() {
$strings = array(
- "" => 0,
+ '' => 0,
"\0" => 0,
- "x" => 1,
+ 'x' => 1,
// Double-width chinese character.
"\xe6\x9d\xb1" => 2,
@@ -115,34 +115,34 @@
public function testUTF8shorten() {
$inputs = array(
- array("1erp derp derp", 9, "", "1erp derp"),
- array("2erp derp derp", 12, "...", "2erp derp..."),
- array("derpxderpxderp", 12, "...", "derpxderp..."),
- array("derp\xE2\x99\x83derpderp", 12, "...", "derp\xE2\x99\x83derp..."),
- array("", 12, "...", ""),
- array("derp", 12, "...", "derp"),
- array("11111", 5, "2222", "11111"),
- array("111111", 5, "2222", "12222"),
-
- array("D1rp. Derp derp.", 7, "...", "D1rp."),
- array("D2rp. Derp derp.", 5, "...", "D2rp."),
- array("D3rp. Derp derp.", 4, "...", "D..."),
- array("D4rp. Derp derp.", 14, "...", "D4rp. Derp..."),
- array("D5rpderp, derp derp", 16, "...", "D5rpderp..."),
- array("D6rpderp, derp derp", 17, "...", "D6rpderp, derp..."),
+ array('1erp derp derp', 9, '', '1erp derp'),
+ array('2erp derp derp', 12, '...', '2erp derp...'),
+ array('derpxderpxderp', 12, '...', 'derpxderp...'),
+ array("derp\xE2\x99\x83derpderp", 12, '...', "derp\xE2\x99\x83derp..."),
+ array('', 12, '...', ''),
+ array('derp', 12, '...', 'derp'),
+ array('11111', 5, '2222', '11111'),
+ array('111111', 5, '2222', '12222'),
+
+ array('D1rp. Derp derp.', 7, '...', 'D1rp.'),
+ array('D2rp. Derp derp.', 5, '...', 'D2rp.'),
+ array('D3rp. Derp derp.', 4, '...', 'D...'),
+ array('D4rp. Derp derp.', 14, '...', 'D4rp. Derp...'),
+ array('D5rpderp, derp derp', 16, '...', 'D5rpderp...'),
+ array('D6rpderp, derp derp', 17, '...', 'D6rpderp, derp...'),
// Strings with combining characters.
- array("Gr\xCD\xA0mpyCatSmiles", 8, "...", "Gr\xCD\xA0mpy..."),
- array("X\xCD\xA0\xCD\xA0\xCD\xA0Y", 1, "", "X\xCD\xA0\xCD\xA0\xCD\xA0"),
+ array("Gr\xCD\xA0mpyCatSmiles", 8, '...', "Gr\xCD\xA0mpy..."),
+ array("X\xCD\xA0\xCD\xA0\xCD\xA0Y", 1, '', "X\xCD\xA0\xCD\xA0\xCD\xA0"),
// This behavior is maybe a little bad, but it seems mostly reasonable,
// at least for latin languages.
- array("Derp, supercalafragalisticexpialadoshus", 30, "...",
- "Derp..."),
+ array('Derp, supercalafragalisticexpialadoshus', 30, '...',
+ 'Derp...'),
// If a string has only word-break characters in it, we should just cut
// it, not produce only the terminal.
- array("((((((((((", 8, '...', '(((((...'),
+ array('((((((((((', 8, '...', '(((((...'),
// Terminal is longer than requested input.
array('derp', 3, 'quack', 'quack'),
@@ -291,7 +291,7 @@
public function testUTF8Convert() {
if (!function_exists('mb_convert_encoding')) {
- $this->assertSkipped("Requires mbstring extension.");
+ $this->assertSkipped('Requires mbstring extension.');
}
// "[ae]gis se[n]or [(c)] 1970 [+/-] 1 [degree]"
@@ -441,30 +441,30 @@
public function testUTF8BMP() {
$tests = array(
- "" => array(true, true, "empty string"),
- "a" => array(true, true, "a"),
- "a\xCD\xA0\xCD\xA0" => array(true, true, "a with combining"),
- "\xE2\x98\x83" => array(true, true, "snowman"),
+ '' => array(true, true, 'empty string'),
+ 'a' => array(true, true, 'a'),
+ "a\xCD\xA0\xCD\xA0" => array(true, true, 'a with combining'),
+ "\xE2\x98\x83" => array(true, true, 'snowman'),
// This is the last character in BMP, U+FFFF.
- "\xEF\xBF\xBF" => array(true, true, "U+FFFF"),
+ "\xEF\xBF\xBF" => array(true, true, 'U+FFFF'),
// This isn't valid.
- "\xEF\xBF\xC0" => array(false, false, "Invalid, byte range."),
+ "\xEF\xBF\xC0" => array(false, false, 'Invalid, byte range.'),
// This is the first character above BMP, U+10000.
- "\xF0\x90\x80\x80" => array(true, false, "U+10000"),
- "\xF0\x9D\x84\x9E" => array(true, false, "gclef"),
+ "\xF0\x90\x80\x80" => array(true, false, 'U+10000'),
+ "\xF0\x9D\x84\x9E" => array(true, false, 'gclef'),
- "musical \xF0\x9D\x84\x9E g-clef" => array(true, false, "gclef text"),
- "\xF0\x9D\x84" => array(false, false, "Invalid, truncated."),
+ "musical \xF0\x9D\x84\x9E g-clef" => array(true, false, 'gclef text'),
+ "\xF0\x9D\x84" => array(false, false, 'Invalid, truncated.'),
- "\xE0\x80\x80" => array(false, false, "Nonminimal 3-byte character."),
+ "\xE0\x80\x80" => array(false, false, 'Nonminimal 3-byte character.'),
// Partial BMP characters.
- "\xCD" => array(false, false, "Partial 2-byte character."),
- "\xE0\xA0" => array(false, false, "Partial BMP 0xE0 character."),
- "\xE2\x98" => array(false, false, "Partial BMP cahracter."),
+ "\xCD" => array(false, false, 'Partial 2-byte character.'),
+ "\xE0\xA0" => array(false, false, 'Partial BMP 0xE0 character.'),
+ "\xE2\x98" => array(false, false, 'Partial BMP cahracter.'),
);
foreach ($tests as $input => $test) {
diff --git a/src/utils/__tests__/PhutilUtilsTestCase.php b/src/utils/__tests__/PhutilUtilsTestCase.php
--- a/src/utils/__tests__/PhutilUtilsTestCase.php
+++ b/src/utils/__tests__/PhutilUtilsTestCase.php
@@ -226,11 +226,11 @@
$this->assertEqual(
null,
- assert_stringlike(""));
+ assert_stringlike(''));
$this->assertEqual(
null,
- assert_stringlike("Hello World"));
+ assert_stringlike('Hello World'));
$this->assertEqual(
null,
@@ -260,8 +260,8 @@
$this->assertTrue($caught instanceof InvalidArgumentException);
$array = array(
- "foo" => "bar",
- "bar" => "foo",
+ 'foo' => 'bar',
+ 'bar' => 'foo',
);
try {
@@ -345,8 +345,8 @@
public function testSplitLines() {
$retain_cases = array(
- "" => array(""),
- "x" => array("x"),
+ '' => array(''),
+ 'x' => array('x'),
"x\n" => array("x\n"),
"\n" => array("\n"),
"\n\n\n" => array("\n", "\n", "\n"),
@@ -364,15 +364,15 @@
}
$discard_cases = array(
- "" => array(""),
- "x" => array("x"),
- "x\n" => array("x"),
- "\n" => array(""),
- "\n\n\n" => array("", "", ""),
- "\r\n" => array(""),
- "x\r\ny\n" => array("x", "y"),
- "x\ry\nz\r\n" => array("x\ry", "z"),
- "x\ry\nz\r\n\n" => array("x\ry", "z", ""),
+ '' => array(''),
+ 'x' => array('x'),
+ "x\n" => array('x'),
+ "\n" => array(''),
+ "\n\n\n" => array('', '', ''),
+ "\r\n" => array(''),
+ "x\r\ny\n" => array('x', 'y'),
+ "x\ry\nz\r\n" => array("x\ry", 'z'),
+ "x\ry\nz\r\n\n" => array("x\ry", 'z', ''),
);
foreach ($discard_cases as $input => $expect) {
@@ -435,8 +435,8 @@
public function testLoggableString() {
$this->assertEqual(
- "",
- phutil_loggable_string(""));
+ '',
+ phutil_loggable_string(''));
$this->assertEqual(
"a\\nb",
diff --git a/src/utils/utf8.php b/src/utils/utf8.php
--- a/src/utils/utf8.php
+++ b/src/utils/utf8.php
@@ -238,7 +238,7 @@
$ii += 1;
continue;
} else if ($byte < "\xC0") {
- throw new Exception("Invalid UTF-8 string passed to phutil_utf8v().");
+ throw new Exception('Invalid UTF-8 string passed to phutil_utf8v().');
} else if ($byte <= "\xDF") {
$seq_len = 2;
} else if ($byte <= "\xEF") {
@@ -250,15 +250,15 @@
} else if ($byte <= "\xFD") {
$seq_len = 6;
} else {
- throw new Exception("Invalid UTF-8 string passed to phutil_utf8v().");
+ throw new Exception('Invalid UTF-8 string passed to phutil_utf8v().');
}
if ($ii + $seq_len > $len) {
- throw new Exception("Invalid UTF-8 string passed to phutil_utf8v().");
+ throw new Exception('Invalid UTF-8 string passed to phutil_utf8v().');
}
for ($jj = 1; $jj < $seq_len; ++$jj) {
if ($string[$ii + $jj] >= "\xC0") {
- throw new Exception("Invalid UTF-8 string passed to phutil_utf8v().");
+ throw new Exception('Invalid UTF-8 string passed to phutil_utf8v().');
}
}
$res[] = substr($string, $ii, $seq_len);
@@ -541,13 +541,13 @@
function phutil_utf8_convert($string, $to_encoding, $from_encoding) {
if (!$from_encoding) {
throw new InvalidArgumentException(
- "Attempting to convert a string encoding, but no source encoding ".
- "was provided. Explicitly provide the source encoding.");
+ 'Attempting to convert a string encoding, but no source encoding '.
+ 'was provided. Explicitly provide the source encoding.');
}
if (!$to_encoding) {
throw new InvalidArgumentException(
- "Attempting to convert a string encoding, but no target encoding ".
- "was provided. Explicitly provide the target encoding.");
+ 'Attempting to convert a string encoding, but no target encoding '.
+ 'was provided. Explicitly provide the target encoding.');
}
// Normalize encoding names so we can no-op the very common case of UTF8
@@ -752,7 +752,7 @@
if (
$array_length > 0 &&
phutil_utf8_is_combining_character($components[0])) {
- $string = " ".$string;
+ $string = ' '.$string;
$components = phutil_utf8v($string);
$array_length++;
}
diff --git a/src/utils/utils.php b/src/utils/utils.php
--- a/src/utils/utils.php
+++ b/src/utils/utils.php
@@ -577,7 +577,7 @@
}
throw new InvalidArgumentException(
- "Argument must be scalar or object which implements __toString()!");
+ 'Argument must be scalar or object which implements __toString()!');
}
/**
@@ -854,7 +854,7 @@
function phutil_exit($status = 0) {
$event = new PhutilEvent(
PhutilEventType::TYPE_WILLEXITABRUPTLY,
- array("status" => $status));
+ array('status' => $status));
PhutilEventEngine::dispatchEvent($event);
exit($status);
@@ -875,7 +875,7 @@
$result = '';
static $c_map = array(
- "\\" => '\\\\',
+ '\\' => '\\\\',
"\n" => '\\n',
"\r" => '\\r',
"\t" => '\\t',
diff --git a/src/xsprintf/csprintf.php b/src/xsprintf/csprintf.php
--- a/src/xsprintf/csprintf.php
+++ b/src/xsprintf/csprintf.php
@@ -80,7 +80,7 @@
// Check that the value is a non-empty array.
if (!is_array($value)) {
- throw new Exception("Expected an array for %Ls conversion.");
+ throw new Exception('Expected an array for %Ls conversion.');
}
// Convert the list of strings to a single string.
@@ -99,7 +99,7 @@
case 'P':
if (!($value instanceof PhutilOpaqueEnvelope)) {
throw new Exception(
- "Expected PhutilOpaqueEnvelope for %P conversion.");
+ 'Expected PhutilOpaqueEnvelope for %P conversion.');
}
if ($is_unmasked) {
$value = $value->openEnvelope();
diff --git a/src/xsprintf/qsprintf.php b/src/xsprintf/qsprintf.php
--- a/src/xsprintf/qsprintf.php
+++ b/src/xsprintf/qsprintf.php
@@ -90,7 +90,7 @@
$prefix = '';
if (!($escaper instanceof PhutilQsprintfInterface)) {
- throw new Exception("Invalid database escaper!");
+ throw new Exception('Invalid database escaper!');
}
switch ($type) {
diff --git a/src/xsprintf/xsprintf.php b/src/xsprintf/xsprintf.php
--- a/src/xsprintf/xsprintf.php
+++ b/src/xsprintf/xsprintf.php
@@ -57,7 +57,7 @@
$arg++;
if ($arg >= $argc) {
- throw new Exception("Too few arguments to xsprintf().");
+ throw new Exception('Too few arguments to xsprintf().');
}
$callback($userdata, $pattern, $pos, $argv[$arg], $len);
@@ -72,7 +72,7 @@
}
if ($arg != ($argc - 1)) {
- throw new Exception("Too many arguments to xsprintf().");
+ throw new Exception('Too many arguments to xsprintf().');
}
$argv[0] = $pattern;
@@ -112,6 +112,6 @@
&$value,
&$length) {
throw new Exception(
- "This function exists only to document the call signature for xsprintf() ".
- "callbacks.");
+ 'This function exists only to document the call signature for xsprintf() '.
+ 'callbacks.');
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
May 13 2024, 9:25 PM (4 w, 5 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/kq/mm/u3xbyod2qkoc4zlo
Default Alt Text
D9184.diff (97 KB)
Attached To
Mode
D9184: Change double quotes to single quotes.
Attached
Detach File
Event Timeline
Log In to Comment